Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,61 +1,116 @@
|
||||
package org.nl.acs;
|
||||
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public interface AcsConfig {
|
||||
//指令下发agv
|
||||
/**
|
||||
* 指令下发agv
|
||||
*/
|
||||
String FORKAGV = "forkagv";
|
||||
//单工指令下发agv
|
||||
/**
|
||||
* 单工指令下发agv
|
||||
*/
|
||||
String ONEFORKAGV = "oneforkagv";
|
||||
//同一站点运行最大任务数
|
||||
/**
|
||||
* 同一站点运行最大任务数
|
||||
*/
|
||||
String ONEPOINTMAXTASK = "onePointMaxTask";
|
||||
//同一任务创建最大指令数
|
||||
/**
|
||||
* 同一任务创建最大指令数
|
||||
*/
|
||||
String MAXINSTNUMBER = "maxInstNumber";
|
||||
//创建任务检查
|
||||
/**
|
||||
* 创建任务检查
|
||||
*/
|
||||
String CREATETASKCHECK = "createTaskCheck";
|
||||
//撤销任务检查
|
||||
/**
|
||||
* 撤销任务检查
|
||||
*/
|
||||
String CANCELTASKCHECK = "cancelTaskCheck";
|
||||
//一楼agv系统接口地址
|
||||
/**
|
||||
* 一楼agv系统接口地址
|
||||
*/
|
||||
String AGVURL = "agvurl";
|
||||
//AGV系统端口
|
||||
/**
|
||||
* AGV系统端口
|
||||
*/
|
||||
String AGVPORT = "agvport";
|
||||
//二楼1区agv系统接口地址
|
||||
/**
|
||||
* 二楼1区agv系统接口地址
|
||||
*/
|
||||
String AGVURL2 = "agvurl2";
|
||||
//二楼1区AGV系统端口
|
||||
/**
|
||||
* 二楼1区AGV系统端口
|
||||
*/
|
||||
String AGVPORT2 = "agvport2";
|
||||
//二楼2区agv系统接口地址
|
||||
/**
|
||||
* 二楼2区agv系统接口地址
|
||||
*/
|
||||
String AGVURL22 = "agvurl22";
|
||||
//二楼2区AGV系统端口
|
||||
/**
|
||||
* 二楼2区AGV系统端口
|
||||
*/
|
||||
String AGVPORT22 = "agvport22";
|
||||
//指定AGV系统
|
||||
/**
|
||||
* 指定AGV系统
|
||||
*/
|
||||
String AGVTYPE = "agvType";
|
||||
//WMS系统接口地址
|
||||
/**
|
||||
* WMS系统接口地址
|
||||
*/
|
||||
String WMSURL = "wmsurl";
|
||||
//WCS系统接口地址
|
||||
/**
|
||||
* WCS系统接口地址
|
||||
*/
|
||||
String WCSURL = "wcsurl";
|
||||
|
||||
String HASOTHERSYSTEM = "hasOtherSystem";
|
||||
|
||||
String ERPURL = "erpurl";
|
||||
//是否存在wms系统
|
||||
/**
|
||||
* 是否存在wms系统
|
||||
*/
|
||||
String HASWMS = "hasWms";
|
||||
//lucene日志索引目录
|
||||
/**
|
||||
* lucene日志索引目录
|
||||
*/
|
||||
String LUCENEURL = "luceneUrl";
|
||||
//路由选择
|
||||
/**
|
||||
* 路由选择
|
||||
*/
|
||||
String ROUTE = "route";
|
||||
//忽略取放货校验
|
||||
/**
|
||||
* 忽略取放货校验
|
||||
*/
|
||||
String IGNOREHASGOODS = "ignoreHasGoods";
|
||||
//项目类型
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
String BUSINESSTYPE = "businessType";
|
||||
//海亮贴标设备ip
|
||||
/**
|
||||
* 海亮贴标设备ip
|
||||
*/
|
||||
String LETTERINGURL = "letteringUrl";
|
||||
//海亮贴标设备
|
||||
/**
|
||||
* 海亮贴标设备
|
||||
*/
|
||||
String LETTERINGPORT = "letteringPort";
|
||||
//NDC断线重连reconnection
|
||||
/**
|
||||
* NDC断线重连reconnection
|
||||
*/
|
||||
String NDC_RECONNECTION = "NDC_reconnection";
|
||||
//自动清理日志保留时间
|
||||
/**
|
||||
* 自动清理日志保留时间
|
||||
*/
|
||||
String AutoCleanDays = "AutoCleanDays";
|
||||
//最大任务下发时间
|
||||
/**
|
||||
* 最大任务下发时间
|
||||
*/
|
||||
String MAXSENDTASKTIME = "maxSendTaskTime";
|
||||
//指令下发立库
|
||||
/**
|
||||
* 指令下发立库
|
||||
*/
|
||||
String INSTSENDLK = "instSendLk";
|
||||
}
|
||||
|
||||
@@ -1,13 +1,46 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public interface ComparatorAsc<T> {
|
||||
/**
|
||||
* 升序
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @return
|
||||
*/
|
||||
boolean small(T var1, T var2);
|
||||
|
||||
/**
|
||||
* 降序
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @return
|
||||
*/
|
||||
boolean big(T var1, T var2);
|
||||
|
||||
/**
|
||||
* 无比较
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @return
|
||||
*/
|
||||
boolean hasNoCompare(T var1, T var2);
|
||||
|
||||
/**
|
||||
* 只有第一个比较
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @return
|
||||
*/
|
||||
boolean onlyFirstNotCompare(T var1, T var2);
|
||||
|
||||
/**
|
||||
* 只有第二个比较
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @return
|
||||
*/
|
||||
boolean onlySecondNotCompare(T var1, T var2);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public abstract class ComparatorEx<T> implements Comparator<T> {
|
||||
private ComparatorAsc<T> ces;
|
||||
private boolean smallFirst = true;
|
||||
@@ -66,6 +68,7 @@ public abstract class ComparatorEx<T> implements Comparator<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
if (o1 != null && o2 != null) {
|
||||
return this.ces.hasNoCompare(o1, o2) ? this.notCompareFirst(o1, o2, this.notCompareFirst) : this.smallFirst(o1, o2, this.smallFirst);
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public interface CompareOrder {
|
||||
/**
|
||||
* 排序
|
||||
* @return
|
||||
*/
|
||||
default int getOrder() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class CompareOrderComparator extends ComparatorEx<Object> {
|
||||
private static ComparatorAsc<Object> ces = new ComparatorAsc<Object>() {
|
||||
@Override
|
||||
public boolean small(Object o1, Object o2) {
|
||||
return ((CompareOrder) o1).getOrder() < ((CompareOrder) o2).getOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean big(Object o1, Object o2) {
|
||||
return ((CompareOrder) o1).getOrder() > ((CompareOrder) o2).getOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNoCompare(Object o1, Object o2) {
|
||||
return !(o1 instanceof CompareOrder) || !(o2 instanceof CompareOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onlyFirstNotCompare(Object o1, Object o2) {
|
||||
return !(o1 instanceof CompareOrder) && o2 instanceof CompareOrder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onlySecondNotCompare(Object o1, Object o2) {
|
||||
return !(o2 instanceof CompareOrder) && o1 instanceof CompareOrder;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,13 @@ import org.nl.acs.instruction.domain.Instruction;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class InstructionComparator extends ComparatorEx<Instruction> {
|
||||
private static CompareOrderComparator compare = new CompareOrderComparator();
|
||||
private static ComparatorAsc<Instruction> ces = new ComparatorAsc<Instruction>() {
|
||||
@Override
|
||||
public boolean small(Instruction o1, Instruction o2) {
|
||||
Integer level = Integer.parseInt(o1.getPriority());
|
||||
Integer level2 = Integer.parseInt(o2.getPriority());
|
||||
@@ -33,6 +36,7 @@ public class InstructionComparator extends ComparatorEx<Instruction> {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean big(Instruction o1, Instruction o2) {
|
||||
Integer level = Integer.parseInt(o1.getPriority());
|
||||
Integer level2 = Integer.parseInt(o2.getPriority());
|
||||
@@ -56,14 +60,17 @@ public class InstructionComparator extends ComparatorEx<Instruction> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNoCompare(Instruction o1, Instruction o2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onlyFirstNotCompare(Instruction o1, Instruction o2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onlySecondNotCompare(Instruction o1, Instruction o2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public enum OperateType implements OptionType {
|
||||
/**
|
||||
* 人工
|
||||
*/
|
||||
manual("人工", 2),
|
||||
/**
|
||||
* 自动
|
||||
*/
|
||||
auto("自动", 1);
|
||||
|
||||
private String description;
|
||||
@@ -12,10 +20,12 @@ public enum OperateType implements OptionType {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public interface OptionType extends CompareOrder {
|
||||
/**
|
||||
* 获取描述
|
||||
* @return
|
||||
*/
|
||||
String description();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum InstructionStatusEnum {
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
READY("0", "READY", "就绪"),
|
||||
BUSY("1", "BUSY", "执行中"),
|
||||
FINISHED("2", "FINISHED", "完成"),
|
||||
|
||||
@@ -40,17 +40,42 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
List<InstructionDto> queryAll(InstructionQueryParam query);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id /
|
||||
* @return InstructionDto
|
||||
*/
|
||||
InstructionMybatis getById(String id);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
InstructionDto findById(String id);
|
||||
|
||||
/**
|
||||
* 插入一条新数据。
|
||||
* 根据ID更新
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
int updateById(InstructionDto resources);
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id /
|
||||
* @return /
|
||||
*/
|
||||
int removeById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids /
|
||||
* @return /
|
||||
*/
|
||||
int removeByIds(Set<String> ids);
|
||||
|
||||
/**
|
||||
@@ -72,9 +97,9 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getAll(Map whereJson, Pageable page);
|
||||
|
||||
@@ -131,23 +156,34 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
Instruction findByTaskcode(String code);
|
||||
|
||||
/**
|
||||
* 根据任务code查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Instruction
|
||||
*/
|
||||
Instruction findByTaskcodeAndStatus(String code);
|
||||
|
||||
/**
|
||||
* 根据任务id查询
|
||||
*
|
||||
* @param id id
|
||||
* @return Instruction
|
||||
* @param id
|
||||
* @param wherecase
|
||||
* @return
|
||||
*/
|
||||
Instruction findByTaskid(String id, String wherecase);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
void create(Instruction dto) throws Exception;
|
||||
|
||||
/**
|
||||
* 创建2
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
void create2(Instruction dto) throws Exception;
|
||||
|
||||
/**
|
||||
@@ -167,8 +203,8 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
* @param ids
|
||||
* @throws Exception
|
||||
*/
|
||||
void deleteAll(String[] ids) throws Exception;
|
||||
|
||||
@@ -183,45 +219,45 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
/**
|
||||
* 完成指令
|
||||
*
|
||||
* @param id
|
||||
* @throws Exception
|
||||
*/
|
||||
void finish(String id) throws Exception;
|
||||
|
||||
/**
|
||||
* 完成指令
|
||||
*
|
||||
* @param
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
void finish(Instruction dto) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 完成并创建下一条指令
|
||||
*
|
||||
* @param
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
void finishAndCreateNextInst(Instruction dto) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 取消指令
|
||||
*
|
||||
* @param id
|
||||
* @throws Exception
|
||||
*/
|
||||
void cancel(String id) throws Exception;
|
||||
|
||||
/**
|
||||
* 取消指令
|
||||
*
|
||||
* @param id
|
||||
* @throws Exception
|
||||
*/
|
||||
void forceCancel(String id) throws Exception;
|
||||
|
||||
/**
|
||||
* 取消指令不下发agv
|
||||
*
|
||||
* @param id
|
||||
* @throws Exception
|
||||
*/
|
||||
void cancelNOSendAgv(String id) throws Exception;
|
||||
|
||||
@@ -233,7 +269,11 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
Instruction findByCodeFromCache(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
List<Instruction> findByLinkNum(String code);
|
||||
|
||||
/**
|
||||
@@ -252,6 +292,12 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
Instruction findByLinkNumNoSend(String code);
|
||||
|
||||
/**
|
||||
* 根据条码缓存查询
|
||||
*
|
||||
* @param barcode barcode
|
||||
* @return Instruction
|
||||
*/
|
||||
Instruction findByBarcodeFromCache(String barcode);
|
||||
|
||||
/**
|
||||
@@ -271,7 +317,9 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
Instruction findByIdFromCache(String id);
|
||||
|
||||
/**
|
||||
* 格式化
|
||||
* @param inst
|
||||
* @return
|
||||
*/
|
||||
Instruction foramte(Instruction inst);
|
||||
|
||||
@@ -314,21 +362,33 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
//Integer querySameOriginInst(String code);
|
||||
|
||||
/**
|
||||
* 根据编码删除
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
boolean removeByCodeFromCache(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建关联指令
|
||||
* @param type
|
||||
* @param inst
|
||||
* @return
|
||||
*/
|
||||
boolean createLkInst(String type, Instruction inst);
|
||||
|
||||
|
||||
/**
|
||||
* 初始化指令
|
||||
* @param id
|
||||
*/
|
||||
void init(String id);
|
||||
|
||||
/**
|
||||
* 根据指令某个参数查找指令集合
|
||||
*
|
||||
* @param instruction1
|
||||
* @param flay
|
||||
* @return
|
||||
*/
|
||||
|
||||
List<Instruction> findByDeviceCodes(Instruction instruction1, Boolean flay);
|
||||
|
||||
|
||||
@@ -343,6 +403,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
* 导出指令记录
|
||||
* @param instList
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
void downloadInstLogging(List<JSONObject> instList, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package org.nl.acs.instruction.service;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class SortUtlEx {
|
||||
public SortUtlEx() {
|
||||
}
|
||||
|
||||
@@ -84,13 +84,11 @@ import java.util.regex.Pattern;
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, InstructionMybatis> implements InstructionService, ApplicationAutoInitial {
|
||||
|
||||
// private final RedisUtils redisUtils;
|
||||
@Autowired
|
||||
InstructionMapper instructionMapper;
|
||||
@Autowired
|
||||
TaskMapper taskMapper;
|
||||
List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||
// List<InstructionMybatis> instructions_mybatis = new CopyOnWriteArrayList();
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
@@ -283,9 +281,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public List queryAll(String whereJson) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONArray arr = wo.query(whereJson, "create_time").getResultJSONArray(0);
|
||||
// List<Instruction> list = arr.toJavaList(Instruction.class);
|
||||
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex())
|
||||
.list();
|
||||
@@ -295,13 +290,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public Instruction findByCode(String code) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = wo.query("instruction_code ='" + code + "'").uniqueResult(0);
|
||||
// if (ObjectUtil.isEmpty(json)) {
|
||||
// return null;
|
||||
// }
|
||||
// final Instruction obj = json.toJavaObject(Instruction.class);
|
||||
// return obj;
|
||||
|
||||
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.eq(InstructionMybatis::getInstruction_code, code)
|
||||
@@ -314,10 +302,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public Instruction findByTaskcode(String code) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
||||
// final Instruction obj = json.toJavaObject(Instruction.class);
|
||||
// return obj;
|
||||
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.eq(InstructionMybatis::getTask_code, code)
|
||||
.one();
|
||||
@@ -342,15 +326,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public Instruction findByTaskid(String id, String wherecaluse) {
|
||||
// if (!StrUtil.isEmpty(wherecaluse)) {
|
||||
// wherecaluse = " and " + wherecaluse;
|
||||
// }
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = wo.query("task_id ='" + id + "'" + wherecaluse).uniqueResult(0);
|
||||
// if (ObjectUtil.isNotEmpty(json)) {
|
||||
// return json.toJavaObject(Instruction.class);
|
||||
// }
|
||||
// return null;
|
||||
|
||||
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(InstructionMybatis::getTask_id, id);
|
||||
@@ -459,9 +434,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
e.printStackTrace();
|
||||
log.error("");
|
||||
}
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
// wo.insert(json);
|
||||
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||
instructionMapper.insert(entity);
|
||||
instructions.add(dto);
|
||||
@@ -473,7 +445,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
String task_code = dto.getTask_code();
|
||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||
|
||||
// WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||
@@ -494,7 +465,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (StrUtil.isEmpty(dto.getLink_num())) {
|
||||
dto.setIs_send(task.getLink_num());
|
||||
}
|
||||
if (task.getTask_type().equals(CommonFinalParam.ONE) || task.getTask_type().equals("2")) {
|
||||
if (task.getTask_type().equals(CommonFinalParam.ONE) || "2".equals(task.getTask_type())) {
|
||||
dto.setInstruction_type(task.getTask_type());
|
||||
} else if (false) {
|
||||
|
||||
@@ -575,7 +546,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
public void createAgain(Instruction dto) throws Exception {
|
||||
String task_code = dto.getTask_code();
|
||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||
// WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||
@@ -632,10 +602,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
//
|
||||
// wo.insert(json);
|
||||
|
||||
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||
instructionMapper.insert(entity);
|
||||
@@ -744,7 +710,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
entity.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||
String instnextdevice = entity.getNext_device_code();
|
||||
String insttaskid = entity.getTask_id();
|
||||
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
Device startdevice = appService.findDeviceByCode(entity.getStart_device_code());
|
||||
if (ObjectUtils.isEmpty(startdevice)) {
|
||||
@@ -797,15 +763,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
jo.put("islock", "0");
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
// wo.update(json);
|
||||
|
||||
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||
instructionMapper.updateById(ins);
|
||||
|
||||
// JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
|
||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
||||
|
||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.eq(Task::getTask_id, insttaskid)
|
||||
@@ -828,19 +789,12 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
public void finish(Instruction dto) {
|
||||
String now = DateUtil.now();
|
||||
dto.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
//
|
||||
// wo.update(json);
|
||||
|
||||
InstructionMybatis ins = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||
instructionMapper.updateById(ins);
|
||||
|
||||
String instnextdevice = dto.getNext_device_code();
|
||||
String insttaskid = dto.getTask_id();
|
||||
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
|
||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
||||
|
||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.eq(Task::getTask_id, insttaskid)
|
||||
@@ -893,9 +847,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
public void finishAndCreateNextInst(Instruction dto) {
|
||||
dto = foramte(dto);
|
||||
String device_code = dto.getNext_device_code();
|
||||
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONObject taskjson = taskwo.query("task_id ='" + dto.getTask_id() + "'").uniqueResult(0);
|
||||
// TaskDto acsTask = taskjson.toJavaObject(TaskDto.class);
|
||||
Task acsTask = new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.eq(Task::getTask_id, dto.getTask_id())
|
||||
.one();
|
||||
@@ -1041,9 +992,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
// wo.update(json);
|
||||
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||
instructionMapper.updateById(ins);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
@@ -1101,9 +1049,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
// wo.update(json);
|
||||
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||
instructionMapper.updateById(ins);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
@@ -1158,9 +1103,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
// wo.update(json);
|
||||
|
||||
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||
instructionMapper.updateById(ins);
|
||||
|
||||
@@ -15,6 +15,11 @@ import org.springframework.stereotype.Repository;
|
||||
*/
|
||||
@Repository
|
||||
public interface InstructionMapper extends CommonMapper<InstructionMybatis> {
|
||||
/**
|
||||
* 根据任务id获取指令
|
||||
* @param task_id
|
||||
* @return
|
||||
*/
|
||||
List<Instruction> getByTaskId(@Param("task_id") String task_id);
|
||||
// List<Instruction> getallbyinstruction_statusAndis_delete();
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.Socket;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class ClientUDWReceive implements Runnable {
|
||||
private static final Logger log = LoggerFactory.getLogger(ClientUDWReceive.class);
|
||||
private InputStream is;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.nl.acs.socket;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class SocketConfig {
|
||||
public static String udw_unit_key = "socket";
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@ import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Component
|
||||
public class SocketListenerAutoRun extends AbstractAutoRunnable implements SocketService {
|
||||
private static final Logger log = LoggerFactory.getLogger(SocketListenerAutoRun.class);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.nl.acs.socket;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class SocketProperties {
|
||||
public static Integer server_port = 10000;
|
||||
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
package org.nl.acs.socket;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public interface SocketService {
|
||||
/**
|
||||
* 判断客户端是否在线
|
||||
*
|
||||
* @param var1
|
||||
* @return
|
||||
*/
|
||||
boolean isOnline(String var1);
|
||||
|
||||
/**
|
||||
* 获取客户端输出流
|
||||
* @param var1
|
||||
* @return
|
||||
*/
|
||||
OutputStream getOutputStream(String var1);
|
||||
}
|
||||
|
||||
@@ -38,19 +38,49 @@ public interface StorageCellService extends CommonService<StorageCell> {
|
||||
*/
|
||||
List<StorageCellDto> queryAll(StorageCellQueryParam query);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return StorageCellDto
|
||||
*/
|
||||
StorageCell getById(String id);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return StorageCellDto
|
||||
*/
|
||||
StorageCellDto findById(String id);
|
||||
|
||||
/**
|
||||
* 插入一条新数据。
|
||||
* 新增数据
|
||||
*
|
||||
* @param resources /
|
||||
* @return StorageCellDto
|
||||
*/
|
||||
int insert(StorageCellDto resources);
|
||||
|
||||
/**
|
||||
* 根据id修改
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
int updateById(StorageCellDto resources);
|
||||
|
||||
/**
|
||||
* 根据id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int removeById(String id);
|
||||
|
||||
/**
|
||||
* 根据id批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int removeByIds(Set<String> ids);
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,7 +48,6 @@ import java.util.*;
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class StorageCellServiceImpl extends CommonServiceImpl<StorageCellMapper, StorageCell> implements StorageCellService {
|
||||
|
||||
// private final RedisUtils redisUtils;
|
||||
private final StorageCellMapper storageCellMapper;
|
||||
|
||||
@Override
|
||||
@@ -185,16 +184,7 @@ public class StorageCellServiceImpl extends CommonServiceImpl<StorageCellMapper,
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public StorageCellDto findByAddress(String address) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
||||
// JSONObject json = wo.query("address ='" + address + "'").uniqueResult(0);
|
||||
// if (ObjectUtil.isNotEmpty(json)){
|
||||
// final StorageCellDto obj = json.toJavaObject(StorageCellDto.class);
|
||||
// return obj;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
@@ -14,6 +14,11 @@ import org.springframework.stereotype.Repository;
|
||||
@Repository
|
||||
public interface StorageCellMapper extends CommonMapper<StorageCell> {
|
||||
|
||||
/**
|
||||
* 根据存储单元编号删除
|
||||
* @param storage_code
|
||||
* @return
|
||||
*/
|
||||
@Select("delete from acs_storage_cell where substring_index( storage_code,'-',1) = #{storage_code}")
|
||||
int deleteByStorageCode(@Param("storage_code") String storage_code);
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.nl.acs.task;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class TaskInstructionLock {
|
||||
public TaskInstructionLock() {
|
||||
}
|
||||
|
||||
@@ -4,24 +4,48 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AgvSystemTypeEnum {
|
||||
/**
|
||||
* 一期1楼叉车NDC系统
|
||||
*/
|
||||
One_NDC_System_Type("1", "1", "一期1楼叉车NDC系统"),
|
||||
/**
|
||||
* 一期2楼NDC系统
|
||||
*/
|
||||
Two_NDC_System_Type("2", "2", "一期2楼NDC系统"),
|
||||
/**
|
||||
* 仙工AGV系统
|
||||
*/
|
||||
XG_System_Type("3", "3", "仙工AGV系统");
|
||||
|
||||
//索引
|
||||
/**
|
||||
* 索引
|
||||
*/
|
||||
private String index;
|
||||
//编码
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
//名字
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
//描述
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
// 构造方法
|
||||
/**
|
||||
* 构造方法
|
||||
* @param index
|
||||
* @param code
|
||||
* @param name
|
||||
*/
|
||||
AgvSystemTypeEnum(String index, String code, String name) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
|
||||
@@ -5,29 +5,49 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 立库任务类型
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public enum StorageTaskTypeEnum {
|
||||
// 入库任务
|
||||
IN("1", "1", "入库任务"),
|
||||
// 空盘入库任务
|
||||
EMPTY_IN("2", "2", "空盘入库任务"),
|
||||
// 出库任务
|
||||
OUT("3", "3", "出库任务"),
|
||||
// 空盘出库任务
|
||||
EMPTY_OUT("4", "4", "空盘出空任务"),
|
||||
// 转库任务
|
||||
MOVE("5", "5", "转库任务");
|
||||
|
||||
|
||||
//索引
|
||||
/**
|
||||
* 索引
|
||||
*/
|
||||
private String index;
|
||||
//编码
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
//名字
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
//描述
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
// 构造方法
|
||||
/**
|
||||
* 构造方法
|
||||
* @param index
|
||||
* @param code
|
||||
* @param name
|
||||
*/
|
||||
StorageTaskTypeEnum(String index, String code, String name) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
|
||||
@@ -5,26 +5,44 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TaskStatusEnum {
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
READY("0", "READY", "就绪"),
|
||||
BUSY("1", "BUSY", "执行中"),
|
||||
FINISHED("2", "FINISHED", "完成"),
|
||||
CANCEL("3", "CANCEL", "取消"),
|
||||
ERROR("99", "ERROR", "异常");
|
||||
|
||||
//索引
|
||||
/**
|
||||
* 索引
|
||||
*/
|
||||
private String index;
|
||||
//编码
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
//名字
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
//描述
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
// 构造方法
|
||||
/**
|
||||
* 构造方法
|
||||
* @param index
|
||||
* @param code
|
||||
* @param name
|
||||
*/
|
||||
TaskStatusEnum(String index, String code, String name) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
|
||||
@@ -4,10 +4,15 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TaskTypeEnum {
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
Raw_Foil_AGV_Task("1", "1", "生箔AGV任务"),
|
||||
Cutting_AGV_Task("2", "2", "分切AGV任务"),
|
||||
Standard_AGV_Task("3", "3", "普通AGV任务"),
|
||||
@@ -22,16 +27,29 @@ public enum TaskTypeEnum {
|
||||
|
||||
Stacker_Task("11", "11", "堆垛机任务");
|
||||
|
||||
//索引
|
||||
/**
|
||||
* 索引
|
||||
*/
|
||||
private String index;
|
||||
//编码
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
//名字
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String name;
|
||||
//描述
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
// 构造方法
|
||||
/**
|
||||
* 构造方法
|
||||
* @param index
|
||||
* @param code
|
||||
* @param name
|
||||
*/
|
||||
TaskTypeEnum(String index, String code, String name) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
|
||||
@@ -38,19 +38,48 @@ public interface TaskFeedbackService extends CommonService<TaskFeedback> {
|
||||
*/
|
||||
List<TaskFeedbackDto> queryAll(TaskFeedbackQueryParam query);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return TaskFeedback
|
||||
*/
|
||||
TaskFeedback getById(String id);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return TaskFeedbackDto
|
||||
*/
|
||||
TaskFeedbackDto findById(String id);
|
||||
|
||||
/**
|
||||
* 插入一条新数据。
|
||||
* 新增
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
int insert(TaskFeedbackDto resources);
|
||||
|
||||
/**
|
||||
* 根据id修改
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
int updateById(TaskFeedbackDto resources);
|
||||
|
||||
/**
|
||||
* 根据id删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int removeById(String id);
|
||||
|
||||
/**
|
||||
* id批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int removeByIds(Set<String> ids);
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,19 +40,48 @@ public interface TaskService extends CommonService<Task> {
|
||||
*/
|
||||
List<TaskDto> queryAll(TaskQueryParam query);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id /
|
||||
* @return TaskDto
|
||||
*/
|
||||
Task getById(String id);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param id /
|
||||
* @return TaskDto
|
||||
*/
|
||||
TaskDto findById(String id);
|
||||
|
||||
/**
|
||||
* 插入一条新数据。
|
||||
* 新增数据
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
int insert(TaskDto resources);
|
||||
|
||||
/**
|
||||
* 根据id修改数据
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
int updateById(TaskDto resources);
|
||||
|
||||
/**
|
||||
* 根据id删除数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int removeById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除数据
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int removeByIds(Set<String> ids);
|
||||
|
||||
/**
|
||||
@@ -103,7 +132,12 @@ public interface TaskService extends CommonService<Task> {
|
||||
*/
|
||||
List<TaskDto> queryAll(String whereJson);
|
||||
|
||||
|
||||
/**
|
||||
* 根据状态查询
|
||||
*
|
||||
* @param task_status task_status
|
||||
* @return AcsTask
|
||||
*/
|
||||
List<TaskDto> queryAllByStatus(String task_status);
|
||||
|
||||
|
||||
@@ -149,21 +183,30 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 根据设备号查询未执行的任务
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
List<TaskDto> queryTaskByDeviceCode(String device_code);
|
||||
|
||||
/**
|
||||
* 根据设备号查询未执行的任务
|
||||
* @param start_device_code
|
||||
* @return List<TaskDto>
|
||||
*/
|
||||
List<TaskDto> queryTaskByStartDeviceCode(String start_device_code);
|
||||
|
||||
/**
|
||||
* 根据设备号查询未执行的任务
|
||||
* @param back_start_device_code
|
||||
* @return List<TaskDto></TaskDto>
|
||||
*/
|
||||
List<TaskDto> queryTaskByBackDeviceCode(String back_start_device_code);
|
||||
|
||||
/**
|
||||
* 根据设备号和任务状态查询
|
||||
*
|
||||
* @param device_code
|
||||
* @return
|
||||
* @return List<TaskDto></TaskDto>
|
||||
*/
|
||||
List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code);
|
||||
|
||||
@@ -171,7 +214,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
* 根据前工位取货点查找执行中的任务
|
||||
*
|
||||
* @param head_start_device_code
|
||||
* @return
|
||||
* @return List<TaskDto></TaskDto>
|
||||
*/
|
||||
List<TaskDto> queryTaskByStartAndIntStatus(String head_start_device_code);
|
||||
|
||||
@@ -179,34 +222,36 @@ public interface TaskService extends CommonService<Task> {
|
||||
* 根据后工位取货点查找执行中的任务
|
||||
*
|
||||
* @param head_next_device_code
|
||||
* @return
|
||||
* @return List<TaskDto></TaskDto>
|
||||
*/
|
||||
List<TaskDto> queryTaskByNextAndIntStatus(String head_next_device_code);
|
||||
|
||||
|
||||
/**
|
||||
* 根据关联编号查询非立刻下发的关联任务
|
||||
* @param link_num
|
||||
* @return TaskDto
|
||||
*/
|
||||
TaskDto queryTaskByLinkNum(String link_num);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
void create(TaskDto dto) throws Exception;
|
||||
|
||||
/**
|
||||
* 常规任务保存
|
||||
*
|
||||
* @param /
|
||||
* @param json
|
||||
* @throws Exception
|
||||
*/
|
||||
void ordinaryTaskCreate(JSONObject json) throws Exception;
|
||||
|
||||
/**
|
||||
* 特殊任务保存
|
||||
*
|
||||
* @param /
|
||||
* @param json
|
||||
* @throws Exception
|
||||
*/
|
||||
void specialTaskCreate(JSONObject json) throws Exception;
|
||||
|
||||
@@ -219,8 +264,8 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
* @param ids
|
||||
* @throws Exception
|
||||
*/
|
||||
void deleteAll(String[] ids) throws Exception;
|
||||
|
||||
@@ -233,29 +278,41 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
*
|
||||
* @param ids
|
||||
* @throws Exception
|
||||
*/
|
||||
void cancel(String ids) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
*
|
||||
* @param ids
|
||||
* @throws Exception
|
||||
*/
|
||||
void cancelNoSendWms(String ids) throws Exception;
|
||||
|
||||
/**
|
||||
* 手动创建指令
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
Instruction createInst(String ids) throws Exception;
|
||||
|
||||
/**
|
||||
* 手动创建指令
|
||||
* @param inst
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
Instruction createInst(Instruction inst) throws Exception;
|
||||
|
||||
|
||||
/**'
|
||||
* 创建指令
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Instruction createTemporaryInst(TaskDto dto);
|
||||
|
||||
/**
|
||||
@@ -276,12 +333,32 @@ public interface TaskService extends CommonService<Task> {
|
||||
void createTaskByClick(JSONObject json);
|
||||
|
||||
|
||||
/**
|
||||
* 检查是否允许创建任务
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
int checkAllowCreate(String code);
|
||||
|
||||
/**
|
||||
* 从缓存中删除任务
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
boolean removeByCodeFromCache(String code);
|
||||
|
||||
/**
|
||||
* 根据容器编号查询任务
|
||||
* @param container_code
|
||||
* @return
|
||||
*/
|
||||
TaskDto findByContainer(String container_code);
|
||||
|
||||
/**
|
||||
* 根据任务编号查询任务
|
||||
* @param task_code
|
||||
* @return
|
||||
*/
|
||||
TaskDto findByCodeFromCache(String task_code);
|
||||
|
||||
|
||||
@@ -293,8 +370,20 @@ public interface TaskService extends CommonService<Task> {
|
||||
*/
|
||||
TaskDto findByNextCode(String device_code);
|
||||
|
||||
/**
|
||||
* 根据目的地设备编号查询当前是否有设备
|
||||
*
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
List<TaskDto> findAllByNextCode(String device_code);
|
||||
|
||||
/**
|
||||
* 根据设备编号查询当前是否有设备
|
||||
*
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
Integer queryAllTaskMaterialQty(String device_code);
|
||||
|
||||
/**
|
||||
@@ -322,6 +411,12 @@ public interface TaskService extends CommonService<Task> {
|
||||
*/
|
||||
List<TaskDto> findAllTaskFromCache();
|
||||
|
||||
/**
|
||||
* 格式化任务
|
||||
*
|
||||
* @param task
|
||||
* @return
|
||||
*/
|
||||
TaskDto foramte(TaskDto task);
|
||||
|
||||
/**
|
||||
@@ -367,9 +462,10 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 查询相同起终任务的数量
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @param start_device
|
||||
* @param next_device
|
||||
* @param status
|
||||
* @return Integer
|
||||
*/
|
||||
Integer querySameDeviceReadyTask(String start_device, String next_device, String status);
|
||||
|
||||
@@ -384,7 +480,9 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
/**
|
||||
* 导出任务树形记录
|
||||
* @param list
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
void downloadTaskTreeLogging(List<JSONObject> list, HttpServletResponse response) throws IOException;
|
||||
|
||||
@@ -392,6 +490,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
* 导出任务记录
|
||||
* @param all
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
void downloadTaskLogging(List<JSONObject> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ import java.util.*;
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class TaskFeedbackServiceImpl extends CommonServiceImpl<TaskFeedbackMapper, TaskFeedback> implements TaskFeedbackService {
|
||||
|
||||
// private final RedisUtils redisUtils;
|
||||
@Autowired
|
||||
TaskFeedbackMapper taskFeedbackMapper;
|
||||
@Autowired
|
||||
@@ -174,18 +173,9 @@ public class TaskFeedbackServiceImpl extends CommonServiceImpl<TaskFeedbackMappe
|
||||
return ConvertUtil.convertList(insList, TaskFeedbackDto.class);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public TaskFeedbackDto findById(String taskback_id) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task_feedback");
|
||||
// JSONObject json = wo.query("taskback_id ='" + taskback_id + "'").uniqueResult(0);
|
||||
// final TaskFeedbackDto obj = json.toJavaObject(TaskFeedbackDto.class);
|
||||
// return obj;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public TaskFeedbackDto findByCode(String code) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task_feedback");
|
||||
// JSONObject json = wo.query("task_code ='" + code + "' and is_finished='0' ").uniqueResult(0);
|
||||
TaskFeedback taskFeedback = new LambdaQueryChainWrapper<>(taskFeedbackMapper)
|
||||
.eq(TaskFeedback::getTask_code, code)
|
||||
.eq(TaskFeedback::getIs_finished, "0")
|
||||
@@ -209,10 +199,6 @@ public class TaskFeedbackServiceImpl extends CommonServiceImpl<TaskFeedbackMappe
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task_feedback");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
//
|
||||
// wo.insert(json);
|
||||
|
||||
TaskFeedback entity = ConvertUtil.convert(dto, TaskFeedback.class);
|
||||
taskFeedbackMapper.insert(entity);
|
||||
@@ -238,9 +224,7 @@ public class TaskFeedbackServiceImpl extends CommonServiceImpl<TaskFeedbackMappe
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task_feedback");
|
||||
for (String taskback_id : ids) {
|
||||
// wo.delete("taskback_id = '" + taskback_id + "'");
|
||||
taskFeedbackMapper.deleteById(taskback_id);
|
||||
}
|
||||
}
|
||||
@@ -300,7 +284,7 @@ public class TaskFeedbackServiceImpl extends CommonServiceImpl<TaskFeedbackMappe
|
||||
int status = body.getStatus();
|
||||
|
||||
dto.setTask_status(entity.getTask_status());
|
||||
if (status == 200) {
|
||||
if (status == CommonFinalParam.STATUS_OPEN) {
|
||||
dto.setIs_finished(CommonFinalParam.ONE);
|
||||
dto.setError_code("200");
|
||||
dto.setRemark("");
|
||||
|
||||
@@ -88,7 +88,6 @@ import java.util.stream.Collectors;
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> implements TaskService, ApplicationAutoInitial {
|
||||
|
||||
// private final RedisUtils redisUtils;
|
||||
@Autowired
|
||||
TaskMapper taskMapper;
|
||||
@Autowired
|
||||
@@ -366,10 +365,11 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
if (!ObjectUtil.isEmpty(material_type) && !task.getMaterial().equals(material_type)) {
|
||||
continue;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(point_code)
|
||||
&& !(task.getStart_point_code().contains(point_code)
|
||||
|| task.getNext_point_code().contains(point_code))) {
|
||||
continue;
|
||||
if (!ObjectUtil.isEmpty(point_code)) {
|
||||
if(!(task.getStart_point_code().contains(point_code)
|
||||
|| task.getNext_point_code().contains(point_code))){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(task_type) && !task.getTask_type().equals(task_type)) {
|
||||
continue;
|
||||
@@ -415,7 +415,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
|
||||
IPage<Task> queryPage = PageUtil.toMybatisPage(page);
|
||||
LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<>();
|
||||
// wrapper.eq(InstructionMybatis::getIs_delete,"0");
|
||||
if (!StrUtil.isEmpty(task_code)) {
|
||||
wrapper.eq(Task::getTask_code, task_code);
|
||||
}
|
||||
@@ -458,20 +457,9 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
return ConvertUtil.convertList(taskList, TaskDto.class);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public TaskDto findById(String task_id) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONObject json = wo.query("task_id ='" + task_id + "'").uniqueResult(0);
|
||||
// final TaskDto obj = json.toJavaObject(TaskDto.class);
|
||||
// return obj;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryAllUnfinished(Map whereJson) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONArray arr = wo.query("task_status < 2 ").getResultJSONArray(0);
|
||||
// List<TaskDto> list = arr.toJavaList(TaskDto.class);
|
||||
// return list;
|
||||
List<Task> taskList = new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.lt(Task::getTask_status, TaskStatusEnum.FINISHED.getIndex())
|
||||
.list();
|
||||
@@ -480,10 +468,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
|
||||
@Override
|
||||
public TaskDto findByCode(String code) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
||||
// final TaskDto obj = json.toJavaObject(TaskDto.class);
|
||||
// return obj;
|
||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.eq(Task::getTask_code, code)
|
||||
.one();
|
||||
@@ -513,10 +497,11 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
if (!StrUtil.equals(task.getTask_type(), "6")) {
|
||||
continue;
|
||||
}
|
||||
if ((task.getStart_device_code().equals(start_device_code)
|
||||
|| task.getStart_device_code2().equals(start_device_code))
|
||||
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) {
|
||||
list.add(task);
|
||||
if (StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) {
|
||||
if((task.getStart_device_code().equals(start_device_code)
|
||||
|| task.getStart_device_code2().equals(start_device_code))){
|
||||
list.add(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -556,6 +541,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryTaskByStartAndIntStatus(String head_start_device_code) {
|
||||
List<TaskDto> list = new ArrayList<>();
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
@@ -564,18 +550,20 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
if (!StrUtil.equals(task.getTask_type(), "6")) {
|
||||
continue;
|
||||
}
|
||||
if ((task.getStart_device_code().equals(head_start_device_code)
|
||||
|| task.getStart_device_code2().equals(head_start_device_code))
|
||||
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex())) {
|
||||
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
list.add(task);
|
||||
if (StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex())) {
|
||||
if((task.getStart_device_code().equals(head_start_device_code)
|
||||
|| task.getStart_device_code2().equals(head_start_device_code))){
|
||||
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
list.add(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryTaskByNextAndIntStatus(String back_start_device_code) {
|
||||
List<TaskDto> list = new ArrayList<>();
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
@@ -602,10 +590,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryByStauts(String status) {
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONArray arr = wo.query("task_status = '" + status + "'").getResultJSONArray(0);
|
||||
// List<TaskDto> list = arr.toJavaList(TaskDto.class);
|
||||
// return list;
|
||||
List<Task> taskList = new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.eq(Task::getTask_status, status)
|
||||
.list();
|
||||
@@ -764,7 +748,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
TaskDto dto = new TaskDto();
|
||||
Map whereJson = (Map) array.get(i);
|
||||
|
||||
// String device_code = (String) whereJson.get("device_code");
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
dto.setRoute_plan_code("one");
|
||||
String next_device_code = "";
|
||||
@@ -1400,6 +1383,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
return tasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskDto findByContainer(String container_code) {
|
||||
Iterator var3 = tasks.iterator();
|
||||
|
||||
@@ -1413,6 +1397,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskDto findByCodeFromCache(String task_code) {
|
||||
Iterator var3 = tasks.iterator();
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@ import org.nl.acs.device.domain.DeviceAssigned;
|
||||
import org.nl.common.base.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
/**
|
||||
* @author tuqiang
|
||||
*/
|
||||
@Repository
|
||||
public interface TaskScreenMapper extends CommonMapper<Device> {
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
|
||||
/**
|
||||
* @author tuqiang
|
||||
*/
|
||||
public interface TaskScreenService extends IService<Device> {
|
||||
|
||||
/**
|
||||
@@ -14,5 +17,10 @@ public interface TaskScreenService extends IService<Device> {
|
||||
*/
|
||||
JSONArray selectLedList();
|
||||
|
||||
/**
|
||||
* 前端设备下拉选列表
|
||||
* @param device
|
||||
* @return
|
||||
*/
|
||||
JSONObject getLedMessage(String device);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package org.nl.acs.udw;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class UdwConfig {
|
||||
|
||||
//历史记录最大数量
|
||||
/**
|
||||
* 历史记录最大数量
|
||||
*/
|
||||
public static int max_history_length = 10;
|
||||
|
||||
public UdwConfig() {
|
||||
|
||||
@@ -4,6 +4,9 @@ import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Data
|
||||
public class UnifiedData {
|
||||
private Object value;
|
||||
|
||||
@@ -2,16 +2,54 @@ package org.nl.acs.udw;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public interface UnifiedDataAccessor {
|
||||
/**
|
||||
* 获取所有key
|
||||
*
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> getAllKey();
|
||||
|
||||
/**
|
||||
* 获取值
|
||||
*
|
||||
* @param key key
|
||||
* @return Object
|
||||
*/
|
||||
Object getValue(String key);
|
||||
|
||||
/**
|
||||
* 设置值
|
||||
*
|
||||
* @param key key
|
||||
* @param value value
|
||||
*/
|
||||
void setValue(String key, Object value);
|
||||
|
||||
/**
|
||||
* 获取统一数据
|
||||
*
|
||||
* @param key key
|
||||
* @return UnifiedData
|
||||
*/
|
||||
UnifiedData getUnifiedData(String key);
|
||||
|
||||
/**
|
||||
* 获取历史数据
|
||||
*
|
||||
* @param key key
|
||||
* @return List<UnifiedData>
|
||||
*/
|
||||
List<UnifiedData> getHistoryUnifiedData(String key);
|
||||
|
||||
/**
|
||||
* 设置值
|
||||
*
|
||||
* @param key key
|
||||
* @param value value
|
||||
*/
|
||||
void setValueWithPersistence(String key, Object value);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package org.nl.acs.udw;
|
||||
import org.nl.acs.udw.service.impl.UnifiedDataAccessorImpl;
|
||||
import org.nl.acs.udw.service.impl.UnifiedDataAppServiceImpl;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class UnifiedDataAccessorFactory {
|
||||
public UnifiedDataAccessorFactory() {
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import org.nl.acs.udw.service.impl.UnifiedDataUnit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public interface UnifiedDataAppService {
|
||||
/**
|
||||
* 获取所有的key
|
||||
@@ -21,26 +24,89 @@ public interface UnifiedDataAppService {
|
||||
*/
|
||||
UnifiedDataUnit getUnifiedDataUnit(String key);
|
||||
|
||||
/**
|
||||
* 获取数据单元
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @return
|
||||
*/
|
||||
UnifiedData getUnifiedData(String var1, String var2);
|
||||
|
||||
/**
|
||||
* 获取数据值
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @return
|
||||
*/
|
||||
Object getValue(String var1, String var2);
|
||||
|
||||
/**
|
||||
* 设置数据值
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @param var3
|
||||
*/
|
||||
void setValue(String var1, String var2, Object var3);
|
||||
|
||||
/**
|
||||
* 设置数据值,不记录日志
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @param var3
|
||||
*/
|
||||
void setValueNoLog(String var1, String var2, Object var3);
|
||||
|
||||
/**
|
||||
* 获取历史数据
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @return List<UnifiedData
|
||||
*/
|
||||
List<UnifiedData> getHistoryUnifiedData(String var1, String var2);
|
||||
|
||||
/**
|
||||
* 获取所有数据key
|
||||
* @param var1
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> getAllDataKey(String var1);
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param var1
|
||||
* @param var2
|
||||
*/
|
||||
void removeValue(String var1, String var2);
|
||||
|
||||
/**'
|
||||
* 设置数据值,不记录日志
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @param var3
|
||||
*/
|
||||
void setValueWithPersistenceNoLog(String var1, String var2, Object var3);
|
||||
|
||||
/**
|
||||
* 设置数据值,记录日志
|
||||
* @param var1
|
||||
* @param var2
|
||||
* @param var3
|
||||
*/
|
||||
void setValueWithPersistence(String var1, String var2, Object var3);
|
||||
|
||||
/**
|
||||
* 删除数据,记录日志
|
||||
* @param var1
|
||||
* @param var2
|
||||
*/
|
||||
void removeValueWithPersistence(String var1, String var2);
|
||||
|
||||
/**
|
||||
* 判断两个对象是否相等
|
||||
* @param a
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
static boolean isEquals(Object a, Object b) {
|
||||
return ObjectUtil.equal(a, b);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Date;
|
||||
|
||||
/**
|
||||
* 统一数据源管理
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Data
|
||||
public class UdwDto {
|
||||
|
||||
@@ -15,6 +15,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "内存点位管理")
|
||||
|
||||
@@ -7,6 +7,9 @@ import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public interface UdwManageService {
|
||||
/**
|
||||
* 根据条件查询
|
||||
|
||||
@@ -16,6 +16,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Service
|
||||
public class UdwManagerServiceImpl implements UdwManageService {
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@ import org.nl.acs.udw.UnifiedDataAppService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class UnifiedDataAccessorImpl implements UnifiedDataAccessor {
|
||||
private String unified_key;
|
||||
private UnifiedDataAppService unifiedDataAppService;
|
||||
@@ -21,26 +24,32 @@ public class UnifiedDataAccessorImpl implements UnifiedDataAccessor {
|
||||
this.unifiedDataAppService = unifiedDataService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAllKey() {
|
||||
return this.unifiedDataAppService.getAllDataKey(this.unified_key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(String key) {
|
||||
return this.unifiedDataAppService.getValue(this.unified_key, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String key, Object value) {
|
||||
this.unifiedDataAppService.setValue(this.unified_key, key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueWithPersistence(String key, Object value) {
|
||||
this.unifiedDataAppService.setValueWithPersistence(this.unified_key, key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnifiedData getUnifiedData(String key) {
|
||||
return this.unifiedDataAppService.getUnifiedData(this.unified_key, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UnifiedData> getHistoryUnifiedData(String key) {
|
||||
return this.unifiedDataAppService.getHistoryUnifiedData(this.unified_key, key);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import org.nl.common.exception.BadRequestException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Slf4j
|
||||
public class UnifiedDataAppServiceImpl implements UnifiedDataAppService {
|
||||
public static UnifiedDataAppService unifiedDataAppService;
|
||||
@@ -28,15 +31,18 @@ public class UnifiedDataAppServiceImpl implements UnifiedDataAppService {
|
||||
return unifiedDataAppService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAllUnifiedKey() {
|
||||
return new ArrayList(this.factory.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnifiedDataUnit getUnifiedDataUnit(String unified_key) {
|
||||
UnifiedDataUnit dataUnit = (UnifiedDataUnit) this.factory.get(unified_key);
|
||||
return dataUnit == null ? null : dataUnit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAllDataKey(String unified_key) {
|
||||
UnifiedDataUnit dataUnit = (UnifiedDataUnit) this.factory.get(unified_key);
|
||||
if (dataUnit == null) {
|
||||
@@ -47,6 +53,7 @@ public class UnifiedDataAppServiceImpl implements UnifiedDataAppService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnifiedData getUnifiedData(String unified_key, String key) {
|
||||
UnifiedDataUnit dataUnit = this.getUnifiedDataUnit(unified_key);
|
||||
if (dataUnit == null) {
|
||||
@@ -57,11 +64,13 @@ public class UnifiedDataAppServiceImpl implements UnifiedDataAppService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(String unified_key, String key) {
|
||||
UnifiedData unifiedData = this.getUnifiedData(unified_key, key);
|
||||
return unifiedData == null ? null : unifiedData.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeValueWithPersistence(String unified_key, String key) {
|
||||
UnifiedDataUnit dataUnit = this.getUnifiedDataUnit(unified_key);
|
||||
if (dataUnit != null) {
|
||||
@@ -80,6 +89,7 @@ public class UnifiedDataAppServiceImpl implements UnifiedDataAppService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeValue(String unified_key, String key) {
|
||||
UnifiedDataUnit dataUnit = this.getUnifiedDataUnit(unified_key);
|
||||
if (dataUnit != null) {
|
||||
@@ -100,18 +110,22 @@ public class UnifiedDataAppServiceImpl implements UnifiedDataAppService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueNoLog(String unified_key, String key, Object value) {
|
||||
this.setValue(unified_key, key, value, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String unified_key, String key, Object value) {
|
||||
this.setValue(unified_key, key, value, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueWithPersistenceNoLog(String unified_key, String key, Object value) {
|
||||
this.setValue(unified_key, key, value, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueWithPersistence(String unified_key, String key, Object value) {
|
||||
this.setValue(unified_key, key, value, true, true);
|
||||
}
|
||||
@@ -172,6 +186,7 @@ public class UnifiedDataAppServiceImpl implements UnifiedDataAppService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UnifiedData> getHistoryUnifiedData(String unified_key, String key) {
|
||||
UnifiedDataUnit dataUnit = this.getUnifiedDataUnit(unified_key);
|
||||
if (dataUnit == null) {
|
||||
|
||||
@@ -8,6 +8,9 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Data
|
||||
public class UnifiedDataUnit {
|
||||
private String unifiedKey;
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 转换
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class ConvertUtil {
|
||||
public static <T, S> T convert(final S s, Class<T> clz) {
|
||||
|
||||
@@ -226,9 +226,12 @@ public class DateUtil {
|
||||
String second = "00";
|
||||
if (value != null && !"".equals(value.trim())) {
|
||||
int v_int = Integer.valueOf(value);
|
||||
hour = v_int / 3600 + "";//获得小时;
|
||||
minute = v_int % 3600 / 60 + "";//获得小时;
|
||||
second = v_int % 3600 % 60 + "";//获得小时;
|
||||
//获得小时
|
||||
hour = v_int / 3600 + "";;
|
||||
//获得小时
|
||||
minute = v_int % 3600 / 60 + "";;
|
||||
//获得小时
|
||||
second = v_int % 3600 % 60 + "";;
|
||||
}
|
||||
return (hour.length() > 1 ? hour : "0" + hour) + ":" + (minute.length() > 1 ? minute : "0" + minute) + ":" + (second.length() > 1 ? second : "0" + second);
|
||||
}
|
||||
@@ -480,25 +483,32 @@ public class DateUtil {
|
||||
Date dd = DateUtil.strToDate(sdate);
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(dd);
|
||||
if (num.equals(CommonFinalParam.ONE)) // 返回星期一所在的日期
|
||||
// 返回星期一所在的日期
|
||||
if (num.equals(CommonFinalParam.ONE))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
|
||||
} else if (num.equals("2")) // 返回星期二所在的日期
|
||||
// 返回星期二所在的日期
|
||||
} else if ("2".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
|
||||
} else if (num.equals("3")) // 返回星期三所在的日期
|
||||
// 返回星期三所在的日期
|
||||
} else if ("3".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
|
||||
} else if (num.equals("4")) // 返回星期四所在的日期
|
||||
// 返回星期四所在的日期
|
||||
} else if ("4".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
|
||||
} else if (num.equals("5")) // 返回星期五所在的日期
|
||||
// 返回星期五所在的日期
|
||||
} else if ("5".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
|
||||
} else if (num.equals("6")) // 返回星期六所在的日期
|
||||
// 返回星期六所在的日期
|
||||
} else if ("6".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
|
||||
} else if (num.equals("0")) // 返回星期日所在的日期
|
||||
// 返回星期日所在的日期
|
||||
} else if ("0".equals(num))
|
||||
{
|
||||
c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
|
||||
}
|
||||
@@ -551,10 +561,10 @@ public class DateUtil {
|
||||
* @return
|
||||
*/
|
||||
public static long getDays(String date1, String date2) {
|
||||
if (date1 == null || date1.equals("")) {
|
||||
if (date1 == null || "".equals(date1)) {
|
||||
return 0;
|
||||
}
|
||||
if (date2 == null || date2.equals("")) {
|
||||
if (date2 == null || "".equals(date2)) {
|
||||
return 0;
|
||||
}
|
||||
// 转换为标准时间
|
||||
@@ -643,23 +653,27 @@ public class DateUtil {
|
||||
public static String getStringDateMonth(String sdate, String nd, String yf, String rq, String format) {
|
||||
Date currentTime = new Date();
|
||||
String dateString = formatter.format(currentTime);
|
||||
String s_nd = dateString.substring(0, 4); // 年份
|
||||
String s_yf = dateString.substring(5, 7); // 月份
|
||||
String s_rq = dateString.substring(8, 10); // 日期
|
||||
// 年份
|
||||
String s_nd = dateString.substring(0, 4);
|
||||
// 月份
|
||||
String s_yf = dateString.substring(5, 7);
|
||||
// 日期
|
||||
String s_rq = dateString.substring(8, 10);
|
||||
String sreturn = "";
|
||||
//roc.util.MyChar mc = new roc.util.MyChar();
|
||||
//if (sdate == null || sdate.equals("") || !mc.Isdate(sdate)) { // 处理空值情况
|
||||
if (sdate == null || sdate.equals("")) {
|
||||
// 处理空值情况
|
||||
//if (sdate == null || sdate.equals("") || !mc.Isdate(sdate)) {
|
||||
if (sdate == null || "".equals(sdate)) {
|
||||
if (nd.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = s_nd;
|
||||
// 处理间隔符
|
||||
if (format.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = sreturn + "年";
|
||||
} else if (format.equals("2")) {
|
||||
} else if ("2".equals(format)) {
|
||||
sreturn = sreturn + "-";
|
||||
} else if (format.equals("3")) {
|
||||
} else if ("3".equals(format)) {
|
||||
sreturn = sreturn + "/";
|
||||
} else if (format.equals("5")) {
|
||||
} else if ("5".equals(format)) {
|
||||
sreturn = sreturn + ".";
|
||||
}
|
||||
}
|
||||
@@ -668,11 +682,11 @@ public class DateUtil {
|
||||
sreturn = sreturn + s_yf;
|
||||
if (format.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = sreturn + "月";
|
||||
} else if (format.equals("2")) {
|
||||
} else if ("2".equals(format)) {
|
||||
sreturn = sreturn + "-";
|
||||
} else if (format.equals("3")) {
|
||||
} else if ("3".equals(format)) {
|
||||
sreturn = sreturn + "/";
|
||||
} else if (format.equals("5")) {
|
||||
} else if ("5".equals(format)) {
|
||||
sreturn = sreturn + ".";
|
||||
}
|
||||
}
|
||||
@@ -686,19 +700,22 @@ public class DateUtil {
|
||||
} else {
|
||||
// 不是空值,也是一个合法的日期值,则先将其转换为标准的时间格式
|
||||
sdate = getOKDate(sdate);
|
||||
s_nd = sdate.substring(0, 4); // 年份
|
||||
s_yf = sdate.substring(5, 7); // 月份
|
||||
s_rq = sdate.substring(8, 10); // 日期
|
||||
// 年份
|
||||
s_nd = sdate.substring(0, 4);
|
||||
// 月份
|
||||
s_yf = sdate.substring(5, 7);
|
||||
// 日期
|
||||
s_rq = sdate.substring(8, 10);
|
||||
if (nd.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = s_nd;
|
||||
// 处理间隔符
|
||||
if (format.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = sreturn + "年";
|
||||
} else if (format.equals("2")) {
|
||||
} else if ("2".equals(format)) {
|
||||
sreturn = sreturn + "-";
|
||||
} else if (format.equals("3")) {
|
||||
} else if ("3".equals(format)) {
|
||||
sreturn = sreturn + "/";
|
||||
} else if (format.equals("5")) {
|
||||
} else if ("5".equals(format)) {
|
||||
sreturn = sreturn + ".";
|
||||
}
|
||||
}
|
||||
@@ -707,11 +724,11 @@ public class DateUtil {
|
||||
sreturn = sreturn + s_yf;
|
||||
if (format.equals(CommonFinalParam.ONE)) {
|
||||
sreturn = sreturn + "月";
|
||||
} else if (format.equals("2")) {
|
||||
} else if ("2".equals(format)) {
|
||||
sreturn = sreturn + "-";
|
||||
} else if (format.equals("3")) {
|
||||
} else if ("3".equals(format)) {
|
||||
sreturn = sreturn + "/";
|
||||
} else if (format.equals("5")) {
|
||||
} else if ("5".equals(format)) {
|
||||
sreturn = sreturn + ".";
|
||||
}
|
||||
}
|
||||
@@ -754,7 +771,7 @@ public class DateUtil {
|
||||
* @version 2015-3-31 上午09:29:31 <br/>
|
||||
*/
|
||||
public static String getOKDate(String sdate) {
|
||||
if (sdate == null || sdate.equals("")) {
|
||||
if (sdate == null || "".equals(sdate)) {
|
||||
return getStringDateShort();
|
||||
}
|
||||
|
||||
@@ -840,7 +857,7 @@ public class DateUtil {
|
||||
calendar.setTime(new Date());
|
||||
String five = " 05:00:00";
|
||||
|
||||
if (getDateAMPM().equals("AM") && compareToDateString(getStringDate(), getStringDateShort() + five) == -1) {
|
||||
if ("AM".equals(getDateAMPM()) && compareToDateString(getStringDate(), getStringDateShort() + five) == -1) {
|
||||
dates[0] = getBeforeDay(calendar) + five;
|
||||
dates[1] = getStringDateShort() + five;
|
||||
} else {
|
||||
@@ -856,7 +873,7 @@ public class DateUtil {
|
||||
calendar.setTime(new Date());
|
||||
String five = " 05:00:00";
|
||||
String reStr = "";
|
||||
if (getDateAMPM().equals("AM") && compareToDateString(getStringDate(), getStringDateShort() + five) == -1) {
|
||||
if ("AM".equals(getDateAMPM()) && compareToDateString(getStringDate(), getStringDateShort() + five) == -1) {
|
||||
reStr = getBeforeDay(calendar);
|
||||
} else {
|
||||
reStr = getStringDateShort();
|
||||
|
||||
@@ -14,6 +14,9 @@ import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
public class ExportCSVUtil {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ExportCSVUtil.class);
|
||||
|
||||
@@ -27,6 +27,9 @@ import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* @author 20220102CG\noblelift
|
||||
*/
|
||||
@Slf4j
|
||||
public class ReadUtil {
|
||||
|
||||
@@ -69,7 +72,7 @@ public class ReadUtil {
|
||||
String key = (String) it.next();
|
||||
Item byteItem = group.addItem(key);
|
||||
Object o = strings.get(key);
|
||||
if (o == null || o.equals("")) {
|
||||
if (o == null || "".equals(o)) {
|
||||
break;
|
||||
}
|
||||
WriteRequest write1 = new WriteRequest(byteItem, new JIVariant(o.toString()));
|
||||
|
||||
Reference in New Issue
Block a user