提交 121f7c03 authored 作者: zhoushaopan's avatar zhoushaopan

feat(装备模块): 修改了缓存

修改了缓存
上级 a21c1ed8
......@@ -1183,6 +1183,16 @@ public class DeviceLibraryController {
return setOrderNumber(sortNum, allListAndParent);
}
@ApiOperation(value = "测试缓存", notes = "测试缓存")
@PostMapping("/testCache")
public ResponseEntity testCache(String seqNumber){
List<DeviceLibrary> allDeviceLibraryList = cacheLibraryService.getAllDeviceLibraryList();
List<DeviceLibrary> collect =
allDeviceLibraryList.stream().filter(deviceLibrary -> deviceLibrary.getSeqNumber().equals(seqNumber))
.collect(Collectors.toList());
return ResponseEntity.ok(collect);
}
@ApiOperation(value = "为工作交接查询装备", notes = "为工作交接查询装备")
@GetMapping("/selectDeviceForWorkUse")
@Transactional(rollbackFor = Exception.class)
......
......@@ -22,6 +22,8 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
List<DeviceLibrary> findAllByIdIn(List<Integer> ids);
List<DeviceLibrary> findAllByRfidCardIdIn(List<String> rfids);
List<DeviceLibrary> getAllByModel(String model);
List<DeviceLibrary> getAllByOwnUnit(String unit);
......@@ -202,6 +204,8 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
List<DeviceLibrary> findByModelAndIsPart(String model,Integer isPart);
DeviceLibrary findByRfidCardIdAndOwnUnitOrLocationUnit(String rfid,String ownUnit,String localtionUnit);
List<DeviceLibrary> findAllByPartParentId(Integer partParentId);
@Transactional
......
......@@ -26,6 +26,5 @@ public interface DeviceLibraryCacheService {
void deletAllDeviceLibraryList();
void asyncUpdateCache();
}
......@@ -519,4 +519,12 @@ public interface DeviceLibraryService {
*/
List<DeviceLibrary> getDeviceByUnitNameAll(Integer unitId);
/**
* 根据id集合查询装备
* @param rfids 装备rfid的集合
*/
DeviceLibrary findRfId(String rfids);
List<DeviceLibrary> findAllByRfids(List<String> rfids);
}
......@@ -68,17 +68,6 @@ public class CacheLibraryServiceImpl implements DeviceLibraryCacheService {
@Override
@CacheEvict(key = "'device'",allEntries=true)
public void deletAllDeviceLibraryList() {
// long l = System.currentTimeMillis();
// List<DeviceLibrary> all = deviceLibraryDao.findAll();
// System.out.println("更新缓存时间"+(System.currentTimeMillis()-l));
}
@Override
@CacheEvict(key = "'device'",allEntries=true)
public void asyncUpdateCache() {
executor.execute(()->{
deviceLibraryCacheService.getAllDeviceLibraryList();
});
}
......
......@@ -17,6 +17,7 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.*;
import com.tykj.dev.device.library.utils.DeviceNumberUtils;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserPublicService;
......@@ -37,6 +38,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
......@@ -1223,6 +1225,20 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return deviceLibraryDao.findAllByOwnUnitInOrLocationUnitIn(unitNames,unitNames);
}
@Resource
private UnitsCache unitsCache;
@Override
public DeviceLibrary findRfId(String rfids) {
Integer unitId = userUtils.getCurrentUnitId();
Units units = unitsCache.findById(unitId);
return deviceLibraryDao.findByRfidCardIdAndOwnUnitOrLocationUnit(rfids,units.getName(),units.getName());
}
@Override
public List<DeviceLibrary> findAllByRfids(List<String> rfids) {
return deviceLibraryDao.findAllByRfidCardIdIn(rfids);
}
// @Override
// @UpdateCache
// public int updatePartParentId(List<Integer> deviceIds) {
......
package com.tykj.dev.device.matching.controller;
import com.lowagie.text.pdf.SequenceList;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.file.entity.FileRet;
......@@ -12,8 +11,9 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.library.subject.vo.*;
import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
import com.tykj.dev.device.matching.repository.MatchingRepairBillDao;
import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidService;
import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidServiceImpl;
import com.tykj.dev.device.matching.service.MatchingDeviceBillService;
import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService;
import com.tykj.dev.device.matching.service.MatchingDeviceModelService;
......@@ -25,11 +25,9 @@ import com.tykj.dev.device.matching.subject.vo.*;
import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.user.cache.UnitsCache;
import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
......@@ -39,8 +37,6 @@ import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.*;
import com.tykj.dev.rfid.entity.vo.PrintVo;
import com.tykj.dev.rfid.entity.vo.RfidPrintVo;
import com.tykj.dev.rfid.service.RfidService;
import com.tykj.dev.rfid.service.impl.RfidServiceImpl;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
......@@ -58,8 +54,6 @@ import javax.annotation.Resource;
import javax.validation.constraints.Min;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -112,7 +106,7 @@ public class MatchingDeviceController {
private MessageService messageService;
@Autowired
private RfidService rfidService;
private MatchingDeviceRfidService matchingDeviceRfidService;
@Autowired
private MatchingDeviceModelService matchingDeviceModelService;
......@@ -243,10 +237,10 @@ public class MatchingDeviceController {
for (MatchingDeviceLibrary matchingDeviceLibrary : matchingDeviceLibraries) {
printVos.add(new PrintVo(String.valueOf(matchingDeviceLibrary.getId()), matchingDeviceLibrary.getModel(),
matchingDeviceLibrary.getName(),matchingDeviceLibrary.getSeqNumber()));
matchingDeviceLibrary.setRfidCardId(RfidServiceImpl.completeRfidStr2(String.valueOf(matchingDeviceLibrary.getId())));
matchingDeviceLibrary.setRfidCardId(MatchingDeviceRfidServiceImpl.completeRfidStr2(String.valueOf(matchingDeviceLibrary.getId())));
matchingDeviceLibraryService.update(matchingDeviceLibrary);
}
rfidService.printString(printVos);
matchingDeviceRfidService.printString(printVos);
}
//set账单新增设备详情
......
package com.tykj.dev.device.matching.rfid;
import com.tykj.dev.rfid.entity.vo.PrintVo;
import com.tykj.dev.rfid.entity.vo.QRCodePrintVo;
import com.tykj.dev.rfid.entity.vo.RfidCreateVo;
import com.tykj.dev.rfid.entity.vo.RfidPrintVo;
import java.util.List;
/**
* 描述:用于调用RFID打印机打印标签
*
* @author HuangXiahao
* @version V1.0
* @packageName com.tykj.equipmentrfid.service
**/
public interface MatchingDeviceRfidService {
/**
* 描述:设置打印机网络端口
*
* @param ip IP
* @param port 端口号
*/
void setNetWorkConnection(String ip, Integer port);
/**
* 描述:自动扫描本机的打印机接口
*/
void scanUsbConnection();
/**
* 描述:调用打印机打印内容(如出现打印不对齐的情况请联系管理员)
*
* @return
*/
boolean printString(List<PrintVo> printVos);
/**
* 描述:调用打印机打印内容(如出现打印不对齐的情况请联系管理员)
*
* @return
*/
boolean printString1(PrintVo printVo);
/**
* 描述:生成装备的RFID表面号
*
* @param list RFID表面号生成类
* @return
*/
List<RfidPrintVo> getRfidNumber(List<RfidCreateVo> list);
/**
* 条码打印机 批量打印
*/
void printByQRcode(List<QRCodePrintVo> qrCodePrintVos);
}
package com.tykj.dev.device.matching.rfid;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.rfid.entity.vo.*;
import com.tykj.dev.rfid.utils.DrawImageUtil;
import com.tykj.dev.rfid.utils.Image2Zpl;
import com.tykj.dev.rfid.utils.PrinterUtil;
import com.zebra.sdk.comm.Connection;
import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.comm.TcpConnection;
import com.zebra.sdk.printer.PrinterLanguage;
import com.zebra.sdk.printer.ZebraPrinter;
import com.zebra.sdk.printer.ZebraPrinterFactory;
import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;
import com.zebra.sdk.printer.discovery.DiscoveredUsbPrinter;
import com.zebra.sdk.printer.discovery.UsbDiscoverer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
/**
* 描述:用于调用RFID打印机打印标签
*
* @author HuangXiahao
* @version V1.0
**/
@Service
@Slf4j
public class MatchingDeviceRfidServiceImpl implements MatchingDeviceRfidService {
private static final int RFID_MAX_LENGTH= 24;
private static final int RFID_LINE_LENGTH = 24;
private static final Integer DEFAULT_USB_INDEX = 0;
private static ZebraPrinter printer;
@Resource
private DeviceLibraryService deviceLibraryService;
/**
* 描述:设置打印机网络端口
*
* @param ip IP
* @param port 端口号
*/
@Override
public void setNetWorkConnection(String ip, Integer port) {
try {
//根据IP和PORT获取Connection
Connection connection = new TcpConnection(ip, port);
connection.open();
//获取打印机实力
printer = ZebraPrinterFactory.getInstance(connection);
} catch (ConnectionException | ZebraPrinterLanguageUnknownException e) {
throw new ApiException(ResultUtil.failed("未找到对应的端口,请检查网络"));
}
}
/**
* 描述:自动扫描本机的打印机接口
*/
@Override
public void scanUsbConnection() {
try {
//根据IP和PORT获取Connection
DiscoveredUsbPrinter[] zebraUsbPrinters = UsbDiscoverer.getZebraUsbPrinters();
Connection connection = zebraUsbPrinters[DEFAULT_USB_INDEX].getConnection();
//获取打印机实力
printer = ZebraPrinterFactory.getInstance(connection);
} catch (ConnectionException | ZebraPrinterLanguageUnknownException e) {
throw new ApiException(ResultUtil.failed("未找到对应的端口,请检查网络"));
}
}
/**
* 描述:调用打印机打印内容(如出现打印不对齐的情况请联系管理员)
*
* @return
*/
@Override
public boolean printString( List<PrintVo> printVos) {
if (printVos==null&&printVos.size()<=0){
throw new ApiException("打印列表为空");
}
try {
Connection connection = new TcpConnection("10.153.4.16", 6101);
// Connection connection = new TcpConnection("192.168.101.100", 9100);
connection.open();
for (PrintVo printVo : printVos) {
printer = ZebraPrinterFactory.getInstance(connection);
String demoFile = createDemoFile(printer.getPrinterControlLanguage(),printVo.getRfidContent(),printVo.getStr1(), printVo.getStr2(),printVo.getStr3(), 55, 50);
printer.sendFileContents(demoFile);
}
connection.close();
} catch (ConnectionException e) {
throw new ApiException("未找到对应的打印机");
} catch (ZebraPrinterLanguageUnknownException e) {
throw new ApiException("打印机内容错误");
} catch (IOException e) {
throw new ApiException("生成打印文件失败");
}
return true;
}
@Override
public boolean printString1(PrintVo printVo) {
try {
Connection connection = new TcpConnection("10.153.4.16", 6101);
connection.open();
printer = ZebraPrinterFactory.getInstance(connection);
String demoFile = createDemoFile(printer.getPrinterControlLanguage(),printVo.getRfidContent(),printVo.getStr1(), printVo.getStr2(),printVo.getStr3(), 55, 50);
printer.sendFileContents(demoFile);
connection.close();
} catch (ConnectionException e) {
throw new ApiException("未找到对应的打印机");
} catch (ZebraPrinterLanguageUnknownException e) {
throw new ApiException("打印机内容错误");
} catch (IOException e) {
throw new ApiException("生成打印文件失败");
}
return true;
}
/**
* @param pl 打印机语言
* @param str1 空格一
* @param str2 空格二
* @param rfidContent 标签数据区内容
* @param marginLeft 标签左边距
* @param marginTop 标签顶部边距
* @return 拼接成功的打印机ZPL
* @throws IOException IO错误
*/
private String createDemoFile(PrinterLanguage pl,String rfidContent ,String str1,String str2,String str3, int marginLeft, int marginTop) throws IOException {
if (!checkRFID(rfidContent)){
throw new ApiException("");
}
File tmpFile = File.createTempFile("TEST_ZEBRA", "LBL");
FileOutputStream os = new FileOutputStream(tmpFile);
byte[] configLabel = null;
SplitStringInfo deviceNumberSplit = spiltLineString("型 号:"+str1, null);
SplitStringInfo contentSplit = spiltLineString("名 称:"+str2, deviceNumberSplit.getStringLineNumber());
SplitStringInfo str3Split = spiltLineString("序列号:"+str3, contentSplit.getStringLineNumber());
//补零
rfidContent = completeRfidStr2(rfidContent);
if (pl == PrinterLanguage.ZPL) {
configLabel = ("^XA\n" +
// "~SD25\n" +
"^CI28"+
"^CW1,E:SIMSUN.TTF"+
"^RS,B30\n"+
"^RFW,H\n" +
"^FD"+rfidContent+"\n" +
"^FS\n" +
"^LH" + marginLeft + "," + marginTop + "\n" +
deviceNumberSplit.getSplitString()+
contentSplit.getSplitString()+
str3Split.getSplitString()+
"^PQ1,0,1,Y\n" +
"^XZ").getBytes();
}
os.write(configLabel);
os.flush();
os.close();
return tmpFile.getAbsolutePath();
}
/**
* @param rfidStr 主键id
* @return rfid拼接字符串
* 补全核心装备rfid卡号,首位为0
*/
public static String completeRfidStr(String rfidStr){
int needCompleteLength = RFID_MAX_LENGTH - rfidStr.length();
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < needCompleteLength; i++) {
stringBuilder.append("0");
}
return stringBuilder.append(rfidStr).toString().toUpperCase();
}
/**
* @param rfidStr 主键id
* @return rfid拼接字符串
* 补全配套设备rfid卡号,首位为1
*/
public static String completeRfidStr2(String rfidStr){
int needCompleteLength = RFID_MAX_LENGTH - rfidStr.length();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("1");
for (int i = 0; i < needCompleteLength-1; i++) {
stringBuilder.append("0");
}
return stringBuilder.append(rfidStr).toString().toUpperCase();
}
/**
* 计算RFID每行的ZPL
* @param content
* @return
*/
public static SplitStringInfo spiltLineString(String content, Integer firstLine){
//中文占两个字符,使用正则匹配所有的非字符并将lenght*2
StringBuilder resultStringBuild = new StringBuilder();
Integer line = firstLine!=null?firstLine:0;
int totalLine = getLineNum(content,RFID_LINE_LENGTH);
for (int i = 0; i < totalLine; i++) {
String cutedStr = cutStr(content, RFID_LINE_LENGTH);
resultStringBuild.append("^A1N,25,^FR^FD\n^FO0,"+line*30+"^FD"+cutedStr+"^FS\n");
content = content.substring(cutedStr.length());
line = line+1;
}
return new SplitStringInfo(resultStringBuild.toString(),line);
}
public static int getLineNum(String str, int cutLength){
int changedStrLenght = str.replaceAll("[^\\x00-\\xff]","**").length();
int num = changedStrLenght/cutLength;
if (changedStrLenght%cutLength>0){
num++;
}
return num;
}
public static String cutStr(String str , int cutLength){
int strlen = str.length();
int chrlen = str.replaceAll("[^\\x00-\\xff]","**").length();
if(chrlen<=cutLength){
return str;
}
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0, j=0; i < strlen; i++) {
Character chr = str.charAt(i);
if(chr<=255&&chr>=0){
j++; // ascii码为0-255,一个字符就是一个字节的长度
}else {
j+=2;
}
if(j<=cutLength){ // 当加上当前字符以后,如果总字节长度小于等于L,则将当前字符真实的+在result后
stringBuilder.append(chr);
}else{ // 反之则说明result已经是不拆分字符的情况下最接近L的值了,直接返回
return stringBuilder.toString();
}
}
return "";
}
/**
* 校验RFID的格式
* @param rfidStr 写入标签的数据
* @return
*/
public static Boolean checkRFID(String rfidStr){
int length = rfidStr.length();
if (length>24){
return false;
}
String pattern = "^[A-Z0-9]+";
return Pattern.matches(pattern, rfidStr);
}
public static void main(String[] args) throws ConnectionException, ZebraPrinterLanguageUnknownException, IOException {
// Connection connection = new TcpConnection("192.168.0.222", 6101);
// connection.open();
// printer = ZebraPrinterFactory.getInstance(connection);
// String demoFile = createDemoFile(printer.getPrinterControlLanguage(),"1234","装备号:xxxxxxxxxxxxxxxxxxxxxxxx", "内容:ABCD","序列号:123", 60, 80);
// printer.sendFileContents(demoFile);
}
/**
* 描述:生成装备的RFID表面号
*
* @param list RFID表面号生成类
* @return
*/
@Override
public List<RfidPrintVo> getRfidNumber(List<RfidCreateVo> list) {
List<RfidPrintVo> rfidPrintVos = new ArrayList<>();
//遍历List为每一个创建元素生成对应的RFID表面号
for (RfidCreateVo r : list) {
//如果传入的创建元素中不包含装备ID的话,则生成新的表面号
//否则根据将已经装备的表面号插入LIST
RfidPrintVo rfidPrintVo = new RfidPrintVo();
if (r.getDeviceTId() == null) {
rfidPrintVo.setMakeNumber(r.getProduceNumber());
rfidPrintVo.setDeviceNumber(r.getDeviceNumber());
// rfidPrintVo.setContent(makeRfidNumber(r.getPartType(), r.getDeviceNumber(), r.getProduceNumber(), r.getDeviceType()));
rfidPrintVo.setContent(r.getDeviceNumber());
rfidPrintVos.add(rfidPrintVo);
} else {
DeviceLibrary device = deviceLibraryService.getOne(r.getDeviceTId());
rfidPrintVo.setDeviceNumber(device.getSeqNumber());
rfidPrintVo.setMakeNumber(device.getProdNumber());
rfidPrintVo.setContent(device.getRfidSurfaceId());
rfidPrintVos.add(rfidPrintVo);
}
}
return rfidPrintVos;
}
@Override
public void printByQRcode(List<QRCodePrintVo> qrCodePrintVos) {
if (!qrCodePrintVos.isEmpty()){
throw new ApiException("打印列表为空");
}
qrCodePrintVos.forEach(qrCodePrintVo ->{
BufferedImage bufferedImage = DrawImageUtil.drawImage(qrCodePrintVo.getDeviceId(),
qrCodePrintVo.getModel(),qrCodePrintVo.getName(),qrCodePrintVo.getSeqNumber());
PrinterUtil.execute(Image2Zpl.image2Zpl(bufferedImage));
});
}
/**
* 描述:生成装备的RFID表面号
*
* @param deviceType 装备类型 共10位
* @param partType 配件类型 主体为0 共1位
* @param deviceNumber 装备序列号 由用户填写
* @param produceNumber 生产序列号 用户填写
* @return 生成的RFID表面号
*/
public String makeRfidNumber(String partType, String deviceNumber, String produceNumber, String deviceType) {
//配件类型的长度只能为1
if (partType.length() > 1) {
throw new IllegalArgumentException("配件类型字段过长");
}
StringBuilder stringBuffer = new StringBuilder();
if (deviceType.length() <= 10) {
for (int i = 0; i < 10 - deviceType.length(); i++) {
stringBuffer.append("0");
}
stringBuffer.append(deviceType);
} else {
stringBuffer.append(deviceType.substring(deviceType.length() - 10));
}
stringBuffer.append("p");
stringBuffer.append(partType);
if (deviceNumber.length() < 4) {
for (int i = 0; i < 4 - deviceNumber.length(); i++) {
stringBuffer.append("0");
}
stringBuffer.append(deviceNumber);
} else {
stringBuffer.append(deviceNumber.substring(deviceNumber.length() - 4));
}
if (produceNumber==null){
stringBuffer.append("0000");
}else {
if (produceNumber.length() < 4) {
for (int i = 0; i < 4 - produceNumber.length(); i++) {
stringBuffer.append("0");
}
stringBuffer.append(produceNumber);
} else {
stringBuffer.append(produceNumber.substring(produceNumber.length() - 4));
}
}
return stringBuffer.toString();
}
}
......@@ -8,6 +8,8 @@ import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidService;
import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidServiceImpl;
import com.tykj.dev.device.matching.service.MatchingDeviceLibraryService;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.matching.subject.vo.MatchingUnitVo;
......@@ -24,8 +26,6 @@ import com.tykj.dev.misc.utils.PageUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.rfid.entity.vo.PrintVo;
import com.tykj.dev.rfid.entity.vo.RfidPrintVo;
import com.tykj.dev.rfid.service.RfidService;
import com.tykj.dev.rfid.service.impl.RfidServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
......@@ -62,7 +62,7 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
private DeviceLogService deviceLogService;
@Autowired
private RfidService rfidService;
private MatchingDeviceRfidService matchingDeviceRfidService;
@Resource
private UnitsCache unitsCache;
......@@ -284,14 +284,14 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
//调用打印服务 批量打印
for (RfidPrintVo printVo : rfid) {
MatchingDeviceLibrary matchingDeviceLibrary = map.get(printVo.getMatchingDeviceSeq());
PrintVo printVo1 = new PrintVo(RfidServiceImpl.completeRfidStr(
PrintVo printVo1 = new PrintVo(MatchingDeviceRfidServiceImpl.completeRfidStr(
matchingDeviceLibrary.getSeqNumber()),
matchingDeviceLibrary.getModel(),
matchingDeviceLibrary.getName(),
matchingDeviceLibrary.getSeqNumber());
printVos.add(printVo1);
if ("".equals(matchingDeviceLibrary.getRfidCardId())) {
matchingDeviceLibrary.setRfidCardId(RfidServiceImpl.completeRfidStr(
matchingDeviceLibrary.setRfidCardId(MatchingDeviceRfidServiceImpl.completeRfidStr(
matchingDeviceLibrary.getSeqNumber()));
update(matchingDeviceLibrary);
deviceLogDtos.add(new DeviceLogDto(matchingDeviceLibrary.getId(), "打印标签",
......@@ -302,7 +302,7 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
null,null,null));
}
}
rfidService.printString(printVos.stream().sorted(Comparator.comparing(PrintVo::getRfidContent))
matchingDeviceRfidService.printString(printVos.stream().sorted(Comparator.comparing(PrintVo::getRfidContent))
.collect(Collectors.toList()));
deviceLogService.addAllLog(deviceLogDtos);
}
......@@ -312,18 +312,18 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
MatchingDeviceLibrary matchingDeviceLibrary = getOne(matchingDeviceId);
DeviceLogDto deviceLogDto = null;
// List<PrintVo> printVos = new ArrayList<>();
PrintVo printVo1 = new PrintVo(RfidServiceImpl.completeRfidStr(
PrintVo printVo1 = new PrintVo(MatchingDeviceRfidServiceImpl.completeRfidStr(
matchingDeviceLibrary.getSeqNumber()), matchingDeviceLibrary.getModel(),
matchingDeviceLibrary.getName(), matchingDeviceLibrary.getSeqNumber());
if ("".equals(matchingDeviceLibrary.getRfidCardId())) {
matchingDeviceLibrary.setRfidCardId(RfidServiceImpl.completeRfidStr(matchingDeviceLibrary.getSeqNumber()));
if (rfidService.printString1(printVo1)){
matchingDeviceLibrary.setRfidCardId(MatchingDeviceRfidServiceImpl.completeRfidStr(matchingDeviceLibrary.getSeqNumber()));
if (matchingDeviceRfidService.printString1(printVo1)){
update(matchingDeviceLibrary);
deviceLogDto = new DeviceLogDto(matchingDeviceLibrary.getId(), "打印标签", null, null, null);
}
}
else {
rfidService.printString1(printVo1);
matchingDeviceRfidService.printString1(printVo1);
deviceLogDto = new DeviceLogDto(matchingDeviceLibrary.getId(), "更新标签", null, null, null);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论