fix: instruction
This commit is contained in:
@@ -1,13 +1,46 @@
|
|||||||
package org.nl.acs.instruction;
|
package org.nl.acs.instruction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 20220102CG\noblelift
|
||||||
|
*/
|
||||||
public interface ComparatorAsc<T> {
|
public interface ComparatorAsc<T> {
|
||||||
|
/**
|
||||||
|
* 升序
|
||||||
|
* @param var1
|
||||||
|
* @param var2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
boolean small(T var1, T var2);
|
boolean small(T var1, T var2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 降序
|
||||||
|
* @param var1
|
||||||
|
* @param var2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
boolean big(T var1, T var2);
|
boolean big(T var1, T var2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无比较
|
||||||
|
* @param var1
|
||||||
|
* @param var2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
boolean hasNoCompare(T var1, T var2);
|
boolean hasNoCompare(T var1, T var2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只有第一个比较
|
||||||
|
* @param var1
|
||||||
|
* @param var2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
boolean onlyFirstNotCompare(T var1, T var2);
|
boolean onlyFirstNotCompare(T var1, T var2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只有第二个比较
|
||||||
|
* @param var1
|
||||||
|
* @param var2
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
boolean onlySecondNotCompare(T var1, T var2);
|
boolean onlySecondNotCompare(T var1, T var2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package org.nl.acs.instruction;
|
package org.nl.acs.instruction;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
/**
|
||||||
|
* @author 20220102CG\noblelift
|
||||||
|
*/
|
||||||
public abstract class ComparatorEx<T> implements Comparator<T> {
|
public abstract class ComparatorEx<T> implements Comparator<T> {
|
||||||
private ComparatorAsc<T> ces;
|
private ComparatorAsc<T> ces;
|
||||||
private boolean smallFirst = true;
|
private boolean smallFirst = true;
|
||||||
@@ -66,6 +68,7 @@ public abstract class ComparatorEx<T> implements Comparator<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compare(T o1, T o2) {
|
public int compare(T o1, T o2) {
|
||||||
if (o1 != null && o2 != null) {
|
if (o1 != null && o2 != null) {
|
||||||
return this.ces.hasNoCompare(o1, o2) ? this.notCompareFirst(o1, o2, this.notCompareFirst) : this.smallFirst(o1, o2, this.smallFirst);
|
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;
|
package org.nl.acs.instruction;
|
||||||
|
/**
|
||||||
|
* @author 20220102CG\noblelift
|
||||||
|
*/
|
||||||
public interface CompareOrder {
|
public interface CompareOrder {
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
default int getOrder() {
|
default int getOrder() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,30 @@
|
|||||||
package org.nl.acs.instruction;
|
package org.nl.acs.instruction;
|
||||||
|
/**
|
||||||
|
* @author 20220102CG\noblelift
|
||||||
|
*/
|
||||||
public class CompareOrderComparator extends ComparatorEx<Object> {
|
public class CompareOrderComparator extends ComparatorEx<Object> {
|
||||||
private static ComparatorAsc<Object> ces = new ComparatorAsc<Object>() {
|
private static ComparatorAsc<Object> ces = new ComparatorAsc<Object>() {
|
||||||
|
@Override
|
||||||
public boolean small(Object o1, Object o2) {
|
public boolean small(Object o1, Object o2) {
|
||||||
return ((CompareOrder) o1).getOrder() < ((CompareOrder) o2).getOrder();
|
return ((CompareOrder) o1).getOrder() < ((CompareOrder) o2).getOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean big(Object o1, Object o2) {
|
public boolean big(Object o1, Object o2) {
|
||||||
return ((CompareOrder) o1).getOrder() > ((CompareOrder) o2).getOrder();
|
return ((CompareOrder) o1).getOrder() > ((CompareOrder) o2).getOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasNoCompare(Object o1, Object o2) {
|
public boolean hasNoCompare(Object o1, Object o2) {
|
||||||
return !(o1 instanceof CompareOrder) || !(o2 instanceof CompareOrder);
|
return !(o1 instanceof CompareOrder) || !(o2 instanceof CompareOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean onlyFirstNotCompare(Object o1, Object o2) {
|
public boolean onlyFirstNotCompare(Object o1, Object o2) {
|
||||||
return !(o1 instanceof CompareOrder) && o2 instanceof CompareOrder;
|
return !(o1 instanceof CompareOrder) && o2 instanceof CompareOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean onlySecondNotCompare(Object o1, Object o2) {
|
public boolean onlySecondNotCompare(Object o1, Object o2) {
|
||||||
return !(o2 instanceof CompareOrder) && o1 instanceof CompareOrder;
|
return !(o2 instanceof CompareOrder) && o1 instanceof CompareOrder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,13 @@ import org.nl.acs.instruction.domain.Instruction;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
/**
|
||||||
|
* @author 20220102CG\noblelift
|
||||||
|
*/
|
||||||
public class InstructionComparator extends ComparatorEx<Instruction> {
|
public class InstructionComparator extends ComparatorEx<Instruction> {
|
||||||
private static CompareOrderComparator compare = new CompareOrderComparator();
|
private static CompareOrderComparator compare = new CompareOrderComparator();
|
||||||
private static ComparatorAsc<Instruction> ces = new ComparatorAsc<Instruction>() {
|
private static ComparatorAsc<Instruction> ces = new ComparatorAsc<Instruction>() {
|
||||||
|
@Override
|
||||||
public boolean small(Instruction o1, Instruction o2) {
|
public boolean small(Instruction o1, Instruction o2) {
|
||||||
Integer level = Integer.parseInt(o1.getPriority());
|
Integer level = Integer.parseInt(o1.getPriority());
|
||||||
Integer level2 = Integer.parseInt(o2.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) {
|
public boolean big(Instruction o1, Instruction o2) {
|
||||||
Integer level = Integer.parseInt(o1.getPriority());
|
Integer level = Integer.parseInt(o1.getPriority());
|
||||||
Integer level2 = Integer.parseInt(o2.getPriority());
|
Integer level2 = Integer.parseInt(o2.getPriority());
|
||||||
@@ -56,14 +60,17 @@ public class InstructionComparator extends ComparatorEx<Instruction> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasNoCompare(Instruction o1, Instruction o2) {
|
public boolean hasNoCompare(Instruction o1, Instruction o2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean onlyFirstNotCompare(Instruction o1, Instruction o2) {
|
public boolean onlyFirstNotCompare(Instruction o1, Instruction o2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean onlySecondNotCompare(Instruction o1, Instruction o2) {
|
public boolean onlySecondNotCompare(Instruction o1, Instruction o2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
package org.nl.acs.instruction;
|
package org.nl.acs.instruction;
|
||||||
|
/**
|
||||||
|
* @author 20220102CG\noblelift
|
||||||
|
*/
|
||||||
public enum OperateType implements OptionType {
|
public enum OperateType implements OptionType {
|
||||||
|
/**
|
||||||
|
* 人工
|
||||||
|
*/
|
||||||
manual("人工", 2),
|
manual("人工", 2),
|
||||||
|
/**
|
||||||
|
* 自动
|
||||||
|
*/
|
||||||
auto("自动", 1);
|
auto("自动", 1);
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
@@ -12,10 +20,12 @@ public enum OperateType implements OptionType {
|
|||||||
this.order = order;
|
this.order = order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String description() {
|
public String description() {
|
||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getOrder() {
|
public int getOrder() {
|
||||||
return this.order;
|
return this.order;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
package org.nl.acs.instruction;
|
package org.nl.acs.instruction;
|
||||||
|
/**
|
||||||
|
* @author 20220102CG\noblelift
|
||||||
|
*/
|
||||||
public interface OptionType extends CompareOrder {
|
public interface OptionType extends CompareOrder {
|
||||||
|
/**
|
||||||
|
* 获取描述
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
String description();
|
String description();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum InstructionStatusEnum {
|
public enum InstructionStatusEnum {
|
||||||
|
/**
|
||||||
|
* 任务状态
|
||||||
|
*/
|
||||||
READY("0", "READY", "就绪"),
|
READY("0", "READY", "就绪"),
|
||||||
BUSY("1", "BUSY", "执行中"),
|
BUSY("1", "BUSY", "执行中"),
|
||||||
FINISHED("2", "FINISHED", "完成"),
|
FINISHED("2", "FINISHED", "完成"),
|
||||||
|
|||||||
@@ -40,17 +40,42 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
*/
|
*/
|
||||||
List<InstructionDto> queryAll(InstructionQueryParam query);
|
List<InstructionDto> queryAll(InstructionQueryParam query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
*
|
||||||
|
* @param id /
|
||||||
|
* @return InstructionDto
|
||||||
|
*/
|
||||||
InstructionMybatis getById(String id);
|
InstructionMybatis getById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
InstructionDto findById(String id);
|
InstructionDto findById(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入一条新数据。
|
* 根据ID更新
|
||||||
|
* @param resources
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
int updateById(InstructionDto resources);
|
int updateById(InstructionDto resources);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID删除
|
||||||
|
*
|
||||||
|
* @param id /
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
int removeById(String id);
|
int removeById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param ids /
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
int removeByIds(Set<String> ids);
|
int removeByIds(Set<String> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,9 +97,9 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
*
|
* @param whereJson
|
||||||
* @param page 分页参数
|
* @param page
|
||||||
* @return Map<String, Object>
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getAll(Map whereJson, Pageable page);
|
Map<String, Object> getAll(Map whereJson, Pageable page);
|
||||||
|
|
||||||
@@ -131,23 +156,34 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
*/
|
*/
|
||||||
Instruction findByTaskcode(String code);
|
Instruction findByTaskcode(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务code查询
|
||||||
|
*
|
||||||
|
* @param code code
|
||||||
|
* @return Instruction
|
||||||
|
*/
|
||||||
Instruction findByTaskcodeAndStatus(String code);
|
Instruction findByTaskcodeAndStatus(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据任务id查询
|
* 根据任务id查询
|
||||||
*
|
* @param id
|
||||||
* @param id id
|
* @param wherecase
|
||||||
* @return Instruction
|
* @return
|
||||||
*/
|
*/
|
||||||
Instruction findByTaskid(String id, String wherecase);
|
Instruction findByTaskid(String id, String wherecase);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
*
|
* @param dto
|
||||||
* @param dto /
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
void create(Instruction dto) throws Exception;
|
void create(Instruction dto) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建2
|
||||||
|
* @param dto
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
void create2(Instruction 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;
|
void deleteAll(String[] ids) throws Exception;
|
||||||
|
|
||||||
@@ -183,45 +219,45 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 完成指令
|
* 完成指令
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
void finish(String id) throws Exception;
|
void finish(String id) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 完成指令
|
* 完成指令
|
||||||
*
|
* @param dto
|
||||||
* @param
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
void finish(Instruction dto) throws Exception;
|
void finish(Instruction dto) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 完成并创建下一条指令
|
* 完成并创建下一条指令
|
||||||
*
|
* @param dto
|
||||||
* @param
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
void finishAndCreateNextInst(Instruction dto) throws Exception;
|
void finishAndCreateNextInst(Instruction dto) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消指令
|
* 取消指令
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
void cancel(String id) throws Exception;
|
void cancel(String id) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消指令
|
* 取消指令
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
void forceCancel(String id) throws Exception;
|
void forceCancel(String id) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消指令不下发agv
|
* 取消指令不下发agv
|
||||||
*
|
|
||||||
* @param id
|
* @param id
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
void cancelNOSendAgv(String id) throws Exception;
|
void cancelNOSendAgv(String id) throws Exception;
|
||||||
|
|
||||||
@@ -233,7 +269,11 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
*/
|
*/
|
||||||
Instruction findByCodeFromCache(String code);
|
Instruction findByCodeFromCache(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码查询
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List<Instruction> findByLinkNum(String code);
|
List<Instruction> findByLinkNum(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,6 +292,12 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
*/
|
*/
|
||||||
Instruction findByLinkNumNoSend(String code);
|
Instruction findByLinkNumNoSend(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条码缓存查询
|
||||||
|
*
|
||||||
|
* @param barcode barcode
|
||||||
|
* @return Instruction
|
||||||
|
*/
|
||||||
Instruction findByBarcodeFromCache(String barcode);
|
Instruction findByBarcodeFromCache(String barcode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -271,7 +317,9 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
Instruction findByIdFromCache(String id);
|
Instruction findByIdFromCache(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 格式化
|
||||||
* @param inst
|
* @param inst
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
Instruction foramte(Instruction inst);
|
Instruction foramte(Instruction inst);
|
||||||
|
|
||||||
@@ -314,21 +362,33 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
*/
|
*/
|
||||||
//Integer querySameOriginInst(String code);
|
//Integer querySameOriginInst(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码删除
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
boolean removeByCodeFromCache(String code);
|
boolean removeByCodeFromCache(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建关联指令
|
||||||
|
* @param type
|
||||||
|
* @param inst
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
boolean createLkInst(String type, Instruction inst);
|
boolean createLkInst(String type, Instruction inst);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化指令
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
void init(String id);
|
void init(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据指令某个参数查找指令集合
|
* 根据指令某个参数查找指令集合
|
||||||
*
|
|
||||||
* @param instruction1
|
* @param instruction1
|
||||||
|
* @param flay
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
List<Instruction> findByDeviceCodes(Instruction instruction1, Boolean flay);
|
List<Instruction> findByDeviceCodes(Instruction instruction1, Boolean flay);
|
||||||
|
|
||||||
|
|
||||||
@@ -343,6 +403,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
|||||||
* 导出指令记录
|
* 导出指令记录
|
||||||
* @param instList
|
* @param instList
|
||||||
* @param response
|
* @param response
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
void downloadInstLogging(List<JSONObject> instList, HttpServletResponse 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.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* @author 20220102CG\noblelift
|
||||||
|
*/
|
||||||
public class SortUtlEx {
|
public class SortUtlEx {
|
||||||
public SortUtlEx() {
|
public SortUtlEx() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,13 +84,11 @@ import java.util.regex.Pattern;
|
|||||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||||
public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, InstructionMybatis> implements InstructionService, ApplicationAutoInitial {
|
public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper, InstructionMybatis> implements InstructionService, ApplicationAutoInitial {
|
||||||
|
|
||||||
// private final RedisUtils redisUtils;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
InstructionMapper instructionMapper;
|
InstructionMapper instructionMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
TaskMapper taskMapper;
|
TaskMapper taskMapper;
|
||||||
List<Instruction> instructions = new CopyOnWriteArrayList();
|
List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||||
// List<InstructionMybatis> instructions_mybatis = new CopyOnWriteArrayList();
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DeviceAppService deviceAppService;
|
DeviceAppService deviceAppService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -283,9 +281,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List queryAll(String whereJson) {
|
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)
|
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||||
.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex())
|
.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex())
|
||||||
.list();
|
.list();
|
||||||
@@ -295,13 +290,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByCode(String code) {
|
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)
|
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||||
.eq(InstructionMybatis::getInstruction_code, code)
|
.eq(InstructionMybatis::getInstruction_code, code)
|
||||||
@@ -314,10 +302,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByTaskcode(String code) {
|
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)
|
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||||
.eq(InstructionMybatis::getTask_code, code)
|
.eq(InstructionMybatis::getTask_code, code)
|
||||||
.one();
|
.one();
|
||||||
@@ -342,15 +326,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Instruction findByTaskid(String id, String wherecaluse) {
|
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<>();
|
LambdaQueryWrapper<InstructionMybatis> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(InstructionMybatis::getTask_id, id);
|
wrapper.eq(InstructionMybatis::getTask_id, id);
|
||||||
@@ -459,9 +434,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("");
|
log.error("");
|
||||||
}
|
}
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
|
||||||
// wo.insert(json);
|
|
||||||
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||||
instructionMapper.insert(entity);
|
instructionMapper.insert(entity);
|
||||||
instructions.add(dto);
|
instructions.add(dto);
|
||||||
@@ -473,7 +445,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
String task_code = dto.getTask_code();
|
String task_code = dto.getTask_code();
|
||||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||||
|
|
||||||
// WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||||
@@ -494,7 +465,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
if (StrUtil.isEmpty(dto.getLink_num())) {
|
if (StrUtil.isEmpty(dto.getLink_num())) {
|
||||||
dto.setIs_send(task.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());
|
dto.setInstruction_type(task.getTask_type());
|
||||||
} else if (false) {
|
} else if (false) {
|
||||||
|
|
||||||
@@ -575,7 +546,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
public void createAgain(Instruction dto) throws Exception {
|
public void createAgain(Instruction dto) throws Exception {
|
||||||
String task_code = dto.getTask_code();
|
String task_code = dto.getTask_code();
|
||||||
TaskDto task = taskService.findByCodeFromCache(task_code);
|
TaskDto task = taskService.findByCodeFromCache(task_code);
|
||||||
// WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||||
@@ -632,10 +602,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setCreate_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);
|
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||||
instructionMapper.insert(entity);
|
instructionMapper.insert(entity);
|
||||||
@@ -744,7 +710,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
entity.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
entity.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||||
String instnextdevice = entity.getNext_device_code();
|
String instnextdevice = entity.getNext_device_code();
|
||||||
String insttaskid = entity.getTask_id();
|
String insttaskid = entity.getTask_id();
|
||||||
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
Device startdevice = appService.findDeviceByCode(entity.getStart_device_code());
|
Device startdevice = appService.findDeviceByCode(entity.getStart_device_code());
|
||||||
if (ObjectUtils.isEmpty(startdevice)) {
|
if (ObjectUtils.isEmpty(startdevice)) {
|
||||||
@@ -797,15 +763,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
jo.put("islock", "0");
|
jo.put("islock", "0");
|
||||||
deviceService.changeDeviceStatus(jo);
|
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);
|
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||||
instructionMapper.updateById(ins);
|
instructionMapper.updateById(ins);
|
||||||
|
|
||||||
// JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
|
|
||||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
|
||||||
|
|
||||||
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_id, insttaskid)
|
.eq(Task::getTask_id, insttaskid)
|
||||||
@@ -828,19 +789,12 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
public void finish(Instruction dto) {
|
public void finish(Instruction dto) {
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
dto.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
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);
|
InstructionMybatis ins = ConvertUtil.convert(dto, InstructionMybatis.class);
|
||||||
instructionMapper.updateById(ins);
|
instructionMapper.updateById(ins);
|
||||||
|
|
||||||
String instnextdevice = dto.getNext_device_code();
|
String instnextdevice = dto.getNext_device_code();
|
||||||
String insttaskid = dto.getTask_id();
|
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)
|
Task task = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_id, insttaskid)
|
.eq(Task::getTask_id, insttaskid)
|
||||||
@@ -893,9 +847,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
public void finishAndCreateNextInst(Instruction dto) {
|
public void finishAndCreateNextInst(Instruction dto) {
|
||||||
dto = foramte(dto);
|
dto = foramte(dto);
|
||||||
String device_code = dto.getNext_device_code();
|
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)
|
Task acsTask = new LambdaQueryChainWrapper<>(taskMapper)
|
||||||
.eq(Task::getTask_id, dto.getTask_id())
|
.eq(Task::getTask_id, dto.getTask_id())
|
||||||
.one();
|
.one();
|
||||||
@@ -1041,9 +992,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
entity.setUpdate_time(now);
|
entity.setUpdate_time(now);
|
||||||
entity.setUpdate_by(currentUsername);
|
entity.setUpdate_by(currentUsername);
|
||||||
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
|
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);
|
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||||
instructionMapper.updateById(ins);
|
instructionMapper.updateById(ins);
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
@@ -1101,9 +1049,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
entity.setUpdate_time(now);
|
entity.setUpdate_time(now);
|
||||||
entity.setUpdate_by(currentUsername);
|
entity.setUpdate_by(currentUsername);
|
||||||
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
|
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);
|
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||||
instructionMapper.updateById(ins);
|
instructionMapper.updateById(ins);
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
@@ -1158,9 +1103,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
|||||||
entity.setUpdate_time(now);
|
entity.setUpdate_time(now);
|
||||||
entity.setUpdate_by(currentUsername);
|
entity.setUpdate_by(currentUsername);
|
||||||
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
|
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);
|
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
|
||||||
instructionMapper.updateById(ins);
|
instructionMapper.updateById(ins);
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ import org.springframework.stereotype.Repository;
|
|||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface InstructionMapper extends CommonMapper<InstructionMybatis> {
|
public interface InstructionMapper extends CommonMapper<InstructionMybatis> {
|
||||||
|
/**
|
||||||
|
* 根据任务id获取指令
|
||||||
|
* @param task_id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List<Instruction> getByTaskId(@Param("task_id") String task_id);
|
List<Instruction> getByTaskId(@Param("task_id") String task_id);
|
||||||
// List<Instruction> getallbyinstruction_statusAndis_delete();
|
// List<Instruction> getallbyinstruction_statusAndis_delete();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user