提交 9f739621 authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 7963aee4
......@@ -164,6 +164,12 @@ public class AllotBillController {
else {
AllotBill allotBill = allotBillService.getOne(taskService.get(allotBillSaveVo.getTaskId()).getBillId());
MapperUtils.copyNoNullProperties(a,allotBill);
if (a.getApplyFiles()==null||"".equals(a.getApplyFiles())){
allotBill.setApplyFiles(null);
}
if (a.getReplyFiles()==null||"".equals(a.getReplyFiles())){
allotBill.setReplyFiles(null);
}
allotBillEntity = allotBillService.update(allotBill);
}
Calendar calendar = Calendar.getInstance();
......
......@@ -103,6 +103,12 @@ public class BackController {
else {
allotBackBill = allotBackBillService.getOne(taskService.get(allotBillSaveVo.getTaskId()).getBillId());
MapperUtils.copyNoNullProperties(a,allotBackBill);
if (a.getApplyFiles()==null||"".equals(a.getApplyFiles())){
allotBackBill.setApplyFiles(null);
}
if (a.getReplyFiles()==null||"".equals(a.getReplyFiles())){
allotBackBill.setReplyFiles(null);
}
allotBackBill = allotBackBillService.update(allotBackBill);
}
Calendar calendar = Calendar.getInstance();
......
......@@ -557,4 +557,25 @@ public class DeviceApplyController {
script.getChilds().forEach(s -> addScript(scripts,s));
}
}
@ApiOperation(value = "手动办结申请任务", notes = "手动办结申请任务")
@PostMapping("/over/{id}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity over(@PathVariable("id") int taskId) {
TaskBto taskBto = taskService.get(taskId);
taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId());
taskService.moveToEnd(taskBto);
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto.getBillId());
deviceApplyBill.setApplyStatus(2);
deviceApplyBillService.update(deviceApplyBill);
//发送阅知信息
MessageBto messageBto = new MessageBto();
messageBto.setContent("业务办结");
messageBto.setTaskId(taskBto.getId());
messageBto.setIsHighLight(0);
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userUtils.getCurrentUserId()));
messageBto.setBusinessType(taskBto.getBusinessType());
messageService.add(messageBto);
return ResponseEntity.ok("办结成功");
}
}
......@@ -125,7 +125,6 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
TaskBto taskBto = taskMap.get(taskId).parse2Bto();
DeviceApplyBill deviceApplyBill = billMap.get(taskBto.getBillId());
Boolean isComplete = true;
if (deviceApplyBill.getReplyVos()!=null&&!"".equals(deviceApplyBill.getReplyVos())) {
List<ReplyVo> replyVos = JacksonUtil.readValue(deviceApplyBill.getReplyVos(), new TypeReference<List<ReplyVo>>() {
});
......@@ -166,6 +165,7 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
}
}
if (isComplete){
taskService.addInvolveUser(taskBto,userUtils.getCurrentUserId());
taskService.moveToEnd(taskBto);
//发送阅知信息
MessageBto messageBto = new MessageBto();
......
......@@ -50,9 +50,9 @@ public enum LogType {
RFID_3(16,TAG.id, RFID_BUSINESS_NEED_CONFIRM.id, ARCHIVE.id, "标签替换审核失败"),
SELF_CHECK_1(17,SELF_CHECK.id, ORIGIN_STATUS.id, SELF_CHECK_CONFIRM.id, "手动自查"),
SELF_CHECK_1(17,SELF_CHECK.id, ORIGIN_STATUS.id, SELF_CHECK_CONFIRM.id, "发起自查"),
SELF_CHECK_2(18,SELF_CHECK.id, WAIT_SELF_CHECK.id, SELF_CHECK_CONFIRM.id, "周期自查"),
SELF_CHECK_2(18,SELF_CHECK.id, WAIT_SELF_CHECK.id, SELF_CHECK_CONFIRM.id, "发起自查"),
SELF_CHECK_3(19,SELF_CHECK.id, SELF_CHECK_CONFIRM.id, END.id, "上传自查单"),
......
......@@ -170,6 +170,7 @@ public class DeviceLibraryController {
Boolean hasOwnUnitDim = deviceLibrarySelectVo.getOwnUnitDim()!=null;
Boolean hasLifeStatusDim = deviceLibrarySelectVo.getLifeStatusDim()!=null;
Boolean hasUpdateTimeDim = deviceLibrarySelectVo.getUpdateTimeDim()!=null;
Boolean hasRfidCardDim = deviceLibrarySelectVo.getRfidCardDim()!=null;
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo);
if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) {
......@@ -181,7 +182,8 @@ public class DeviceLibraryController {
Boolean containOwnUnitDim = !hasOwnUnitDim||deviceLibrary.getOwnUnit().contains(deviceLibrarySelectVo.getOwnUnitDim());
Boolean containLifeStatusDim = !hasLifeStatusDim||deviceLibrary.getLifeStatusName().contains(deviceLibrarySelectVo.getLifeStatusDim());
Boolean containUpdateTimeDim = !hasUpdateTimeDim||sdf.format(deviceLibrary.getUpdateTime()).contains(deviceLibrarySelectVo.getUpdateTimeDim());
return containModelDim&&containNameDim&&containSeqDim&&containLocationUnitDim&&containOwnUnitDim&&containLifeStatusDim&&containUpdateTimeDim;
Boolean containRfidCardDim = !hasRfidCardDim||(deviceLibrary.getRfidCardId()!=null&&deviceLibrary.getRfidCardId().contains(deviceLibrarySelectVo.getRfidCardDim()));
return containModelDim&&containNameDim&&containSeqDim&&containLocationUnitDim&&containOwnUnitDim&&containLifeStatusDim&&containUpdateTimeDim&&containRfidCardDim;
}).collect(Collectors.toList());
}
// List<DeviceVo> deviceVos = resultList.stream().map(DeviceLibrary::parseVo).collect(Collectors.toList());
......@@ -392,7 +394,7 @@ public class DeviceLibraryController {
partList.forEach(DeviceLibrary::setConfigName);
libraryEntities.addAll(partList);
deviceDetailVo.setDeviceList(libraryEntities);
deviceDetailVo.setDeviceLogEntityList(deviceLogEntities);
deviceDetailVo.setDeviceLogEntityList(deviceLogUserVos);
return ResultUtil.success(deviceDetailVo);
} else {
if (deviceLibraryEntity.getPartParentId() == null) {
......
......@@ -48,6 +48,7 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
*/
int countByModelAndLocationUnit(String model, String location);
List<DeviceLibrary> getAllByPartParentId(Integer parentId);
List<DeviceLibrary> getAllByPartParentIdAndIsPart(Integer parentId, Integer isPart);
......@@ -124,6 +125,13 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
@Modifying
@Query("update DeviceLibrary o set o.lifeStatus = :lifeStatus ,o.ownUnit = :unitName ,o.locationUnit = :unitName ,o.updateTime=current_timestamp where o.id in :idList")
int upDateLeftStatusAndOwnUnitName(Integer lifeStatus,String unitName,@Param("idList") List<Integer> idList);
List<DeviceLibrary> findAllByLifeStatus(Integer status);
@Transactional
@Modifying
@Query("update DeviceLibrary o set o.rfidSurfaceId = o.seqNumber ,o.updateTime=current_timestamp where o.id in :idList")
int upDateRfidSurfaceIdAsSeqNumber(@Param("idList") List<Integer> idList);
}
......@@ -121,6 +121,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
// resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getKeyWords().contains(deviceLibrarySelectVo.getContent())).collect(Collectors.toList());
// }
// return GetTreeUtils.splitTree(libraryEntities,DeviceLibrary::getChilds,DeviceLibrary::setChildNull);
libraryEntities.forEach(DeviceLibrary::setConfigName);
return libraryEntities;
}
//areId不为空,查询某个区域下的所有单位的所有装备
......@@ -146,6 +147,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
// resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getKeyWords().contains(deviceLibrarySelectVo.getContent())).collect(Collectors.toList());
// }
// return GetTreeUtils.splitTree(deviceLibraries,DeviceLibrary::getChilds,DeviceLibrary::setChildNull);
libraryEntities.forEach(DeviceLibrary::setConfigName);
return libraryEntities;
}
//省能看到所有装备
......@@ -166,6 +168,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
// resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getKeyWords().contains(deviceLibrarySelectVo.getContent())).collect(Collectors.toList());
// }
// return GetTreeUtils.splitTree(libraryEntities,DeviceLibrary::getChilds,DeviceLibrary::setChildNull);
deviceLibraries.forEach(DeviceLibrary::setConfigName);
return deviceLibraries;
} else {
throw new ApiException(ResultUtil.failed("区域等级只能为1,2,3"));
......@@ -694,10 +697,10 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
}
if (deviceLibrarySelectVo.getIsPrint()!=null){
if (deviceLibrarySelectVo.getIsPrint()==1){
predicateBuilder.notIn("rfidSurfaceId", (Object) null);
predicateBuilder.notIn("rfidCardId", "");
}
else if (deviceLibrarySelectVo.getIsPrint()==0){
predicateBuilder.eq("rfidSurfaceId", (Object) null);
predicateBuilder.in("rfidCardId", null,"");
}
}
if (deviceLibrarySelectVo.getContent() != null) {
......
......@@ -93,6 +93,9 @@ public class DeviceLibrarySelectVo extends CustomPage {
@ApiModelProperty(value = "表面号模糊查询字段")
private String surfaceDim;
@ApiModelProperty(value = "标签编码模糊查询字段")
private String rfidCardDim;
@ApiModelProperty(value = "所在单位模糊查询字段")
private String locationUnitDim;
......
......@@ -260,8 +260,8 @@ public enum StatusEnum {
*/
WAIT_BACK(899, "待配发退回"),
ALLOT_BACKING(900, "装备退回中"),
WAIT_UPLOAD_ALLOT_BACK_FILE(901, "待上传退回单"),
WAIT_UPLOAD_BACK_FILE_2(911, "待上传退回单"),
WAIT_UPLOAD_ALLOT_BACK_FILE(901, "待上传签收单"),
WAIT_UPLOAD_BACK_FILE_2(911, "待上传回执单"),
BACK_DRAFT(922,"草稿"),
BACK_SIGN_WAIT_CONFIRM(930,"申请签章待审核"),
BACK_WAIT_SIGN(931,"等待盖章"),
......
......@@ -56,7 +56,7 @@ public class PackingLibrary {
@ApiModelProperty(value = "是不是配件(0:不是,1:是)")
private Integer isPart;
@ApiModelProperty(value = "是不是配件(0:不是,1:是)")
@ApiModelProperty(value = "是不是目录(0:不是,1:是)")
private Integer isRoot;
@ApiModelProperty(value = "排序号")
......
......@@ -174,6 +174,11 @@ public class RepairController {
repairBill.setStartUserB(repairBillSaveVo.getAgent());
repairBill.setStartUserA(userPublicService.getOne(repairBillSaveVo.getStartUseraId()).getName());
RepairBill repairBill1 = deviceRepairBillService.addEntity(repairBill);
Calendar calendar = Calendar.getInstance();
String s1 = "NO:第" + calendar.get(Calendar.YEAR) + "WX" + repairBill1.getId() + "号";
repairBill1.setDocNum(s1);
deviceRepairBillService.update(repairBill1);
repairBill1.setDocNum(s1);
deviceRepairSendBillEntity.setDeviceRepairBillId(repairBill1.getId());
deviceRepairSendBillService.addEntity(deviceRepairSendBillEntity);
//发起任务
......@@ -181,7 +186,7 @@ public class RepairController {
TaskBto taskBto1 = taskService.start(taskBto);
Integer id = taskBto1.getId();
myWebSocket.sendMessage1();
return ResponseEntity.ok("保存成功"+id);
return ResponseEntity.ok("保存成功"+id+"&"+s1);
}
else {
//更新账单
......@@ -719,12 +724,16 @@ public class RepairController {
repairBackBill.setScriptJson(JacksonUtil.toJSon(repairBackBillSaveVo.getScriptSaveVos()));
}
RepairBackBill repairBackBill1 = deviceRepairBackBillService.save(repairBackBill);
Calendar calendar = Calendar.getInstance();
String s1 = "NO:第" + calendar.get(Calendar.YEAR) + "LQ" + repairBackBill.getId() + "号";
repairBackBill1.setDocNum(s1);
deviceRepairBackBillService.update(repairBackBill1);
//发起任务
TaskBto taskBto = new TaskBto(StatusEnum.REPAIR_BACK_DRAFT.id, "维修退回", null, ".", repairBackBill1.getId(), BusinessEnum.REPAIR_BACK.id,userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto taskBto1 = taskService.start(taskBto);
Integer id = taskBto1.getId();
myWebSocket.sendMessage1();
return ResponseEntity.ok("保存成功"+id);
return ResponseEntity.ok("保存成功"+id+"&"+s1);
}
else {
//更新账单
......@@ -1576,6 +1585,11 @@ public class RepairController {
newDevice.setLifeStatus(2);
}
DeviceLibrary deviceLibrary = deviceLibraryService.addEntity(newDevice);
List<DeviceLibrary> deviceLibraries = deviceLibraryDao.getAllByPartParentId(deviceLibraryEntity.getId());
deviceLibraries.forEach(deviceLibrary1 -> {
deviceLibrary1.setPartParentId(deviceLibrary.getId());
deviceLibraryService.update(deviceLibrary1);
});
//添加新的维修换新装备记录
RepairDetail newRepairDetail = new RepairDetail();
BeanUtils.copyProperties(repairDetail,newRepairDetail);
......
......@@ -31,6 +31,7 @@ import com.tykj.dev.rfid.service.LibraryWarningLogService;
import com.tykj.dev.rfid.service.RfidChangeBillService;
import com.tykj.dev.rfid.service.RfidChangeLogService;
import com.tykj.dev.rfid.service.RfidService;
import com.tykj.dev.rfid.service.impl.RfidServiceImpl;
import com.tykj.dev.rfid.timeTask.InventoryScheduled;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api;
......@@ -108,10 +109,15 @@ public class RfidController {
@ApiOperation(value = "打印标签", notes = "可以通过这个接口打印RFID")
@PostMapping(value = "/print")
public ResponseEntity printRfid(@RequestBody List<RfidPrintVo> rfid) {
Map<String,DeviceLibrary> map = deviceLibraryService.getAllDeviceSeqMap();
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
//调用打印服务 批量打印
for (RfidPrintVo printVo : rfid) {
rfidService.printString(printVo.getMakeNumber(),printVo.getDeviceNumber(),printVo.getContent());
DeviceLibrary deviceLibrary = map.get(printVo.getDeviceNumber());
rfidService.printString(RfidServiceImpl.completeRfidStr(String.valueOf(deviceLibrary.getId())), deviceLibrary.getModel(), deviceLibrary.getName(),deviceLibrary.getSeqNumber());
deviceLogDtos.add(new DeviceLogDto(deviceLibrary.getId(), "打印标签", null));
}
deviceLogService.addAllLog(deviceLogDtos);
return ResultUtil.success("打印成功");
}
......
......@@ -19,4 +19,5 @@ public class RfidPrintVo {
@ApiModelProperty(name = "表面号")
String content;
}
......@@ -32,12 +32,9 @@ public interface RfidService {
/**
* 描述:调用打印机打印内容(如出现打印不对齐的情况请联系管理员)
*
* @param content 打印内容
* @param makeNumber 生产号
* @param deviceNumber 装备号
* @return
*/
boolean printString(String makeNumber,String deviceNumber,String content);
boolean printString(String rfidContent ,String str1,String str2,String str3);
/**
* 描述:生成装备的RFID表面号
......
......@@ -82,25 +82,22 @@ public class RfidServiceImpl implements RfidService {
/**
* 描述:调用打印机打印内容(如出现打印不对齐的情况请联系管理员)
*
* @param content 打印内容
* @param makeNumber 生产号
* @param deviceNumber 装备号
* @return
*/
@Override
public boolean printString(String makeNumber,String deviceNumber,String content) {
public boolean printString(String rfidContent ,String str1,String str2,String str3) {
try {
Connection connection = new TcpConnection("192.168.000.222", 6101);
connection.open();
printer = ZebraPrinterFactory.getInstance(connection);
String demoFile = createDemoFile(printer.getPrinterControlLanguage(),makeNumber,deviceNumber, content, 60, 55);
String demoFile = createDemoFile(printer.getPrinterControlLanguage(),rfidContent,str1, str2,str3, 60, 55);
printer.sendFileContents(demoFile);
} catch (ConnectionException e) {
throw new ApiException(ResultUtil.failed("未找到对应的打印机"));
throw new ApiException("未找到对应的打印机");
} catch (ZebraPrinterLanguageUnknownException e) {
throw new ApiException(ResultUtil.failed("打印机内容错误"));
throw new ApiException("打印机内容错误");
} catch (IOException e) {
throw new ApiException(ResultUtil.failed("生成打印文件失败"));
throw new ApiException("生成打印文件失败");
}
return true;
}
......@@ -115,7 +112,7 @@ public class RfidServiceImpl implements RfidService {
* @return 拼接成功的打印机ZPL
* @throws IOException IO错误
*/
private static String createDemoFile(PrinterLanguage pl,String rfidContent ,String str1,String str2, int marginLeft, int marginTop) throws IOException {
private static String createDemoFile(PrinterLanguage pl,String rfidContent ,String str1,String str2,String str3, int marginLeft, int marginTop) throws IOException {
if (!checkRFID(rfidContent)){
throw new ApiException("");
}
......@@ -123,14 +120,16 @@ public class RfidServiceImpl implements RfidService {
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 deviceNumberSplit = spiltLineString("型号"+str1, null);
SplitStringInfo contentSplit = spiltLineString("名称"+str2, deviceNumberSplit.getStringLineNumber());
SplitStringInfo str3Split = spiltLineString("序列号"+str3, contentSplit.getStringLineNumber());
//补零
rfidContent = completeRfidStr(rfidContent);
if (pl == PrinterLanguage.ZPL) {
configLabel = ("^XA\n" +
// "~SD25\n" +
"^CW1,E:SIMSUN.FNT"+
"^CI28"+
"^CW1,E:SIMSUN.TTF"+
"^RS,B30\n"+
"^RFW,H\n" +
"^FD"+rfidContent+"\n" +
......@@ -138,6 +137,7 @@ public class RfidServiceImpl implements RfidService {
"^LH" + marginLeft + "," + marginTop + "\n" +
deviceNumberSplit.getSplitString()+
contentSplit.getSplitString()+
str3Split.getSplitString()+
"^PQ1,0,1,Y\n" +
"^XZ").getBytes();
}
......@@ -168,7 +168,7 @@ public class RfidServiceImpl implements RfidService {
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,,E:SIM000.FNT^FR^FD\n^FO0,"+line*30+"^FD"+cutedStr+"^FS\n");
resultStringBuild.append("^A1N,25,^FR^FD\n^FO0,"+line*30+"^FD"+cutedStr+"^FS\n");
content = content.substring(cutedStr.length());
line = line+1;
}
......@@ -225,7 +225,7 @@ public class RfidServiceImpl implements RfidService {
Connection connection = new TcpConnection("192.168.0.222", 6101);
connection.open();
printer = ZebraPrinterFactory.getInstance(connection);
String demoFile = createDemoFile(printer.getPrinterControlLanguage(),"1234","装备号:xxxxxxxxxxxxxxxxxxxxxxxx", "内容:ABCD", 60, 80);
String demoFile = createDemoFile(printer.getPrinterControlLanguage(),"1234","装备号:xxxxxxxxxxxxxxxxxxxxxxxx", "内容:ABCD","序列号:123", 60, 80);
printer.sendFileContents(demoFile);
}
......
package com.tykj.dev.device.sendback.service;
import com.sun.xml.internal.bind.v2.runtime.reflect.Lister;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepel;
import com.tykj.dev.device.sendback.entity.domain.DeviceRepelDetail;
import com.tykj.dev.device.sendback.entity.vo.*;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import org.springframework.data.domain.Page;
import java.util.List;
......
......@@ -111,17 +111,22 @@ public class RepelQueryServiceImpl implements RepelQueryService {
if (deviceLibrary.getLifeStatus() == 2 || deviceLibrary.getLifeStatus() == 15 || deviceLibrary.getLifeStatus() == 14 || deviceLibrary.getLifeStatus() == 6) {
deviceLibraries.add(deviceLibrary);
modelMap.put(deviceLibrary.getModel(),"");
typeMap.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
if (deviceLibrary.getType()!=null) {
typeMap.put(deviceLibrary.getType(), deviceLibrary.getTypeName());
}
} else {
deviceLibrariesAbnormal.add(deviceLibrary);
modelMapAbnormal.put(deviceLibrary.getModel(),"");
typeMapAbnormal.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
if (deviceLibrary.getType()!=null) {
typeMapAbnormal.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
}
}
} else {
deviceLibrariesAbnormal.add(deviceLibrary);
modelMapAbnormal.put(deviceLibrary.getModel(),"");
typeMapAbnormal.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
if (deviceLibrary.getType()!=null) {
typeMapAbnormal.put(deviceLibrary.getType(), deviceLibrary.getTypeName());
}
}
}
);
......@@ -140,16 +145,22 @@ public class RepelQueryServiceImpl implements RepelQueryService {
if (deviceLibrary.getLifeStatus() == 2 || deviceLibrary.getLifeStatus() == 15 || deviceLibrary.getLifeStatus() == 14 || deviceLibrary.getLifeStatus() == 6) {
deviceLibraries.add(deviceLibrary);
modelMap.put(deviceLibrary.getModel(),"");
typeMap.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
if (deviceLibrary.getType()!=null) {
typeMap.put(deviceLibrary.getType(), deviceLibrary.getTypeName());
}
} else {
deviceLibrariesAbnormal.add(deviceLibrary);
modelMapAbnormal.put(deviceLibrary.getModel(),"");
typeMapAbnormal.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
if (deviceLibrary.getType()!=null) {
typeMapAbnormal.put(deviceLibrary.getType(), deviceLibrary.getTypeName());
}
}
} else {
deviceLibrariesAbnormal.add(deviceLibrary);
modelMapAbnormal.put(deviceLibrary.getModel(),"");
typeMapAbnormal.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
if (deviceLibrary.getType()!=null) {
typeMapAbnormal.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
}
}
}
);
......@@ -451,16 +462,22 @@ public class RepelQueryServiceImpl implements RepelQueryService {
if (deviceLibrary.getLifeStatus()==2 ||deviceLibrary.getLifeStatus()==14) {
deviceLibraries.add(deviceLibrary);
modelMap.put(deviceLibrary.getModel(),"");
typeMap.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
if (deviceLibrary.getType()!=null) {
typeMap.put(deviceLibrary.getType(), deviceLibrary.getTypeName());
}
}else {
deviceLibrariesAbnormal.add(deviceLibrary);
modelMapAbnormal.put(deviceLibrary.getModel(),"");
typeMapAbnormal.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
if (deviceLibrary.getType()!=null) {
typeMapAbnormal.put(deviceLibrary.getType(), deviceLibrary.getTypeName());
}
}
}else {
deviceLibrariesAbnormal.add(deviceLibrary);
modelMapAbnormal.put(deviceLibrary.getModel(),"");
typeMapAbnormal.put(deviceLibrary.getType(),deviceLibrary.getTypeName());
if (deviceLibrary.getType()!=null) {
typeMapAbnormal.put(deviceLibrary.getType(), deviceLibrary.getTypeName());
}
}
}
);
......
......@@ -216,7 +216,7 @@ public class StatisticalController {
Boolean containOwnUnitDim = !hasOwnUnitDim||deviceLibrary.getOwnUnit().contains(deviceLibrarySelectVo.getOwnUnitDim());
Boolean containLifeStatusDim = !hasLifeStatusDim||deviceLibrary.getLifeStatusName().contains(deviceLibrarySelectVo.getLifeStatusDim());
Boolean containUpdateTimeDim = !hasUpdateTimeDim||sdf.format(deviceLibrary.getUpdateTime()).contains(deviceLibrarySelectVo.getUpdateTimeDim());
Boolean sameYear = !hasYear||deviceLibrary.getUpdateTime().getYear()==deviceLibrarySelectVo.getYear()-1900;
Boolean sameYear = !hasYear||(deviceLibrary.getUpdateTime()!=null&&deviceLibrary.getUpdateTime().getYear()==deviceLibrarySelectVo.getYear()-1900);
return containModelDim&&containNameDim&&containSeqDim&&containLocationUnitDim&&containOwnUnitDim&&containLifeStatusDim&&containUpdateTimeDim&&sameYear;
}).collect(Collectors.toList());
}
......
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.storage.controller;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.apply.repository.DeviceApplyBillDao;
import com.tykj.dev.device.apply.service.DeviceApplyBillService;
import com.tykj.dev.device.apply.subject.domin.DeviceApplyBill;
import com.tykj.dev.device.apply.subject.vo.ApplyBillDetailVo;
......@@ -15,12 +16,16 @@ import com.tykj.dev.device.library.subject.vo.DeviceLibrarySaveVo;
import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.storage.repository.StorageBillDao;
import com.tykj.dev.device.storage.service.StorageBillService;
import com.tykj.dev.device.storage.subject.domin.StorageBill;
import com.tykj.dev.device.storage.subject.vo.*;
import com.tykj.dev.device.task.repository.TaskDao;
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.task.subject.vo.TaskUserVo;
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.service.UserPublicService;
......@@ -29,6 +34,8 @@ import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.*;
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.ApiOperation;
......@@ -41,6 +48,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toMap;
......@@ -89,6 +97,53 @@ public class StorageBillController {
@Autowired
private DeviceApplyBillService deviceApplyBillService;
@Autowired
private TaskDao taskDao;
@Autowired
private DeviceApplyBillDao deviceApplyBillDao;
@Autowired
private StorageBillDao storageBillDao;
@Autowired
private RfidService rfidService;
@ApiOperation(value = "判断序列号是否存在申请任务中", notes = "判断序列号是否存在申请任务中")
@PostMapping(value = "/existApplyTask")
public ResponseEntity existApplyTask(@RequestBody List<String> seqs){
Map<Integer, Task> taskMap = taskDao.findAllByBusinessTypeAndBillStatus(9, StatusEnum.WAIT_CONFIRM_APPLY_DEVICE.id).stream().collect(Collectors.toMap(Task::getId, Function.identity()));
Map<Integer, DeviceApplyBill> billMap = deviceApplyBillDao.findAll().stream().collect(Collectors.toMap(DeviceApplyBill::getId,Function.identity()));
List<String> hasTaskSeqs = new ArrayList<>();
for (Task task:taskMap.values()) {
DeviceApplyBill deviceApplyBill = billMap.get(task.getBillId());
if (deviceApplyBill.getApplyType()==1){
List<ApplyBillDetailVo> applyBillDetailVos = Objects.requireNonNull(JacksonUtil.readValue(deviceApplyBill.getApplyStat(), new TypeReference<List<ApplyBillDetailVo>>() {
}));
for (ApplyBillDetailVo a :applyBillDetailVos){
List<String> deviceSeqs = DeviceSeqUtil.selectDeviceSeqs(a.getSeqInterval());
deviceSeqs.retainAll(seqs);
if (deviceSeqs.size()>0){
hasTaskSeqs.addAll(deviceSeqs);
}
}
}
}
seqs.removeAll(hasTaskSeqs);
if (seqs.isEmpty()){
Map<String,Object> map = new HashMap<>();
map.put("warn","ok");
map.put("hasTaskSeqs",hasTaskSeqs);
return ResponseEntity.ok(map);
}
else {
Map<String,Object> map = new HashMap<>();
map.put("warn",StringSplitUtil.stringListToString(seqs));
map.put("hasTaskSeqs",hasTaskSeqs);
return ResponseEntity.ok(map);
}
}
@ApiOperation(value = "自动生成序列号", notes = "可以通过这个接口自动生成序列号")
@PostMapping(value = "/autoCreate/{num}")
public ResponseEntity autoCreate(@PathVariable("num") int num){
......@@ -209,17 +264,19 @@ public class StorageBillController {
List<DeviceApplyBill> deviceApplyBills = new ArrayList<>();
Map<Integer, ApplyBillDetailVo> map = new HashMap<>();
Boolean isPrint = storageBillSaveVo.getIsPrint() != 0;
if (storageBillSaveVo.getApplyTaskIds()!=null&&storageBillSaveVo.getApplyTaskIds().size()>0){
for (Integer id:storageBillSaveVo.getApplyTaskIds()) {
TaskBto taskBto1 = taskService.get(id);
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto1.getBillId());
if (deviceApplyBill.getApplyStat()!=null){
List<ApplyBillDetailVo> applyBillDetailVos = Objects.requireNonNull(JacksonUtil.readValue(deviceApplyBill.getApplyStat(), new TypeReference<List<ApplyBillDetailVo>>() {
}));
deviceApplyBill.setApplyBillDetailVos(applyBillDetailVos);
map.putAll(applyBillDetailVos.stream().collect(toMap(ApplyBillDetailVo::getPackingId, Function.identity())));
if (storageBillSaveVo.getApplyTaskIds()!=null){
if (storageBillSaveVo.getApplyTaskIds().size()>0) {
for (Integer id : storageBillSaveVo.getApplyTaskIds()) {
TaskBto taskBto1 = taskService.get(id);
DeviceApplyBill deviceApplyBill = deviceApplyBillService.getOne(taskBto1.getBillId());
if (deviceApplyBill.getApplyStat() != null) {
List<ApplyBillDetailVo> applyBillDetailVos = Objects.requireNonNull(JacksonUtil.readValue(deviceApplyBill.getApplyStat(), new TypeReference<List<ApplyBillDetailVo>>() {
}));
deviceApplyBill.setApplyBillDetailVos(applyBillDetailVos);
map.putAll(applyBillDetailVos.stream().collect(toMap(ApplyBillDetailVo::getPackingId, Function.identity())));
}
deviceApplyBills.add(deviceApplyBill);
}
deviceApplyBills.add(deviceApplyBill);
}
}
//1.存入库单
......@@ -250,13 +307,17 @@ public class StorageBillController {
//存业务日志
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("配发单", storageBillEntity.getFileName(), storageBillEntity.getFileUrl()));
// fileVoList.add(new FileVo("入库确认单", storageBillEntity.getReceiveFileName(), storageBillEntity.getReceiveFileUrl()));
// //添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(taskEntity1.getId(), "发起装备入库", fileVoList);
// taskLogService.addLog(taskLogBto2);
//3.存装备
Integer parentId = null;
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
List<DeviceLibrary> saveEntities = new ArrayList<>();
String logMessage;
if (isPrint){
logMessage = "发起装备入库(打印标签)";
}
else {
logMessage = "发起装备入库(未打印标签)";
}
for (DeviceLibrarySaveVo d : storageBillSaveVo.getDeviceLibrarySaveVoList()) {
if (d.getRfidCardId()==null|| "".equals(d.getRfidCardId()) ||deviceLibraryDao.getAllByRfidCardId(d.getRfidCardId()).size()==0) {
DeviceLibrary saveEntity = new DeviceLibrary();
......@@ -270,13 +331,6 @@ public class StorageBillController {
deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setPartParentId(null);
//如果未打印标签,表面号清空
if (!isPrint){
deviceLibraryEntity.setRfidSurfaceId(null);
}
if (deviceLibraryEntity.getRfidCardId()==null||"".equals(deviceLibraryEntity.getRfidCardId())){
deviceLibraryEntity.setRfidCardId(null);
}
//如果不是单独的配件,设置父装备id为上一个装备的id
if (d.getIsSinglePart() == 0) {
if (deviceLibraryEntity.getIsPart() == 0) {
......@@ -292,9 +346,10 @@ public class StorageBillController {
else {
saveEntity = deviceLibraryService.addEntity(deviceLibraryEntity);
}
saveEntities.add(saveEntity);
stringBuffer.append(saveEntity.getId());
//存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), "发起装备入库", fileVoList);
DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), logMessage, fileVoList);
deviceLogDtos.add(deviceLogDto);
stringBuffer.append("x");
//申请业务列装入库数量+1
......@@ -308,6 +363,14 @@ public class StorageBillController {
throw new ApiException("系统中已存在rfid卡号为"+d.getRfidCardId()+"的装备!");
}
}
//若要打印标签
if(storageBillSaveVo.getIsPrint()==1){
for (DeviceLibrary d : saveEntities) {
rfidService.printString(String.valueOf(d.getId()), d.getModel(), d.getName(),d.getSeqNumber());
d.setRfidCardId(RfidServiceImpl.completeRfidStr(String.valueOf(d.getId())));
deviceLibraryService.update(d);
}
}
//更新申请业务入库数量
if (deviceApplyBills.size()>0){
deviceApplyBills.forEach(deviceApplyBill -> {
......@@ -325,6 +388,7 @@ public class StorageBillController {
}
if (isEnd) {
TaskBto taskBto1 = taskService.get(deviceApplyBill.getId(), 9);
taskService.addInvolveUser(taskBto1,userUtils.getCurrentUserId());
taskService.moveToEnd(taskBto1);
//发送阅知信息
MessageBto messageBto = new MessageBto();
......@@ -351,6 +415,45 @@ public class StorageBillController {
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userId));
messageBto.setBusinessType(taskEntity1.getBusinessType());
messageService.add(messageBto);
//判断是否有申请任务序列号
if (storageBillSaveVo.getApplyTaskIds()==null||storageBillSaveVo.getApplyTaskIds().isEmpty()){
if (storageBillSaveVo.getHasTaskSeqs()!=null&&storageBillSaveVo.getHasTaskSeqs().size()>0){
List<String> hasTaskSeqs = storageBillSaveVo.getHasTaskSeqs();
Map<Integer, Task> taskMap = taskDao.findAllByBusinessTypeAndBillStatus(9, StatusEnum.WAIT_CONFIRM_APPLY_DEVICE.id).stream().collect(Collectors.toMap(Task::getId, Function.identity()));
Map<Integer, DeviceApplyBill> billMap = deviceApplyBillDao.findAll().stream().collect(Collectors.toMap(DeviceApplyBill::getId,Function.identity()));
Boolean isComplete = true;
for (Task task:taskMap.values()) {
DeviceApplyBill deviceApplyBill = billMap.get(task.getBillId());
if (deviceApplyBill.getApplyType()==1){
List<ApplyBillDetailVo> applyBillDetailVos = Objects.requireNonNull(JacksonUtil.readValue(deviceApplyBill.getApplyStat(), new TypeReference<List<ApplyBillDetailVo>>() {
}));
for (ApplyBillDetailVo a :applyBillDetailVos){
List<String> deviceSeqs = DeviceSeqUtil.selectDeviceSeqs(a.getSeqInterval());
deviceSeqs.retainAll(hasTaskSeqs);
if (deviceSeqs.size()>0){
a.setCompleteCount(a.getCompleteCount()+deviceSeqs.size());
if (!a.getCompleteCount().equals(a.getStorageCount())) {
isComplete = false;
}
}
}
deviceApplyBill.setApplyStat(JacksonUtil.toJSon(applyBillDetailVos));
deviceApplyBillService.update(deviceApplyBill);
if (isComplete){
taskService.moveToEnd(task.parse2Bto());
//发送阅知信息
MessageBto messageBto2 = new MessageBto();
messageBto2.setContent("业务办结");
messageBto2.setTaskId(task.getId());
messageBto2.setIsHighLight(0);
messageBto2.setInvolveUserIdList(userPublicService.findOtherUser(userUtils.getCurrentUserId()));
messageBto2.setBusinessType(task.getBusinessType());
messageService.add(messageBto2);
}
}
}
}
}
myWebSocket.sendMessage1();
return ResultUtil.success(taskEntity1);
}
......@@ -489,6 +592,29 @@ public class StorageBillController {
return ResponseEntity.ok(storageBillEntity);
}
@ApiOperation(value = "查询未打印标签入库任务", notes = "查询未打印标签入库任务")
@GetMapping(value = "/selectUnPrintStorageTask")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity selectUnPrintStorageTask() {
List<StorageBill> storageBills = storageBillDao.findAllByStorageStatusAndIsPrint(2,0);
List<Task> tasks = taskDao.findAllByBusinessTypeAndBillIdIn(2,storageBills.stream().map(StorageBill::getId).collect(Collectors.toList()));
return ResponseEntity.ok(tasks.stream().map(Task::parse2Bto).map(TaskBto::toVo).sorted(Comparator.comparing(TaskUserVo::getUpdateTime)).collect(Collectors.toList()));
}
@ApiOperation(value = "入库任务完成打印标签后改变任务打印状态", notes = "入库任务完成打印标签后改变任务打印状态")
@PostMapping(value = "/completePrint/{id}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity completePrint(@PathVariable("taskId") int taskId) {
// Map<Integer,DeviceLibrary> deviceLibraryMap = deviceLibraryService.getAllDeviceMap();
TaskBto taskBto = taskService.get(taskId);
StorageBill storageBillEntity = storageBillService.getOne(taskBto.getBillId());
storageBillEntity.setIsPrint(1);
storageBillService.update(storageBillEntity);
// List<Integer> ids = StringSplitUtil.userIdSplit(storageBillEntity.getStorageDetail());
// deviceLibraryDao.upDateRfidSurfaceIdAsSeqNumber(ids);
return ResponseEntity.ok("ok");
}
// private void setPackingLibrary(List<StorageBillDetailVo> storageBillDetailVos){
// storageBillDetailVos.forEach(storageBillDetailVo -> {
// storageBillDetailVo.setPackingLibrary(packingLibraryService.getOne(storageBillDetailVo.getPackingId()));
......
......@@ -4,8 +4,11 @@ import com.tykj.dev.device.storage.subject.domin.StorageBill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author dengdiyi
*/
public interface StorageBillDao extends JpaRepository<StorageBill, Integer>, JpaSpecificationExecutor<StorageBill> {
List<StorageBill> findAllByStorageStatusAndIsPrint(Integer storageStatus,Integer isPrint);
}
......@@ -112,6 +112,9 @@ public class StorageBillSaveVo {
@ApiModelProperty(value = "入库列装详情")
private List<StorageBillDetail> storageBillDetails = new ArrayList<>();
@ApiModelProperty(value = "存在申请任务的序列号")
private List<String> hasTaskSeqs = new ArrayList<>();
public StorageBill toDo() {
//modelMap复制
ModelMapper mapper = BeanHelper.getUserMapper();
......
......@@ -80,4 +80,6 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
List<Task> findAllByBusinessTypeAndCustomInfo(Integer businessType,String customInfo);
List<Task> findAllByBusinessTypeAndCustomInfoAndBillStatus(Integer businessType,String customInfo,Integer billStatus);
List<Task> findAllByBusinessTypeAndBillIdIn(Integer businessType,List<Integer> billIds);
}
......@@ -898,7 +898,7 @@ public class TaskServiceImpl implements TaskService {
//查询跟踪
if (taskSelectVo.getSelectNum() == 3) {
//所有涉及人员所在单位包含当前用户所在单位且指针对应UserId不是当前用户
List<Integer> status = Arrays.asList(201,333,810,322,722,788,1250,2223,8110,888,140);
List<Integer> status = Arrays.asList(201,333,810,322,722,788,1250,2223,8110,888,140,130,141,111);
List<TaskBto> taskBtoList = taskBtos.stream()
.filter(taskBto -> {
// boolean unitExists = getUnitsByUsers(taskBto.getInvolveUserIdList()).contains(unitId);
......
......@@ -115,6 +115,7 @@ public class TaskSelectController {
@ApiOperation(value = "查询业务对应页面的数据", notes = "可以通过这个接口查询业务对应页面的数据")
@GetMapping("/manage/detail/{id}")
public ResponseEntity selectData(@PathVariable("id") int taskId) {
Map<Integer,DeviceLibrary> deviceLibraryMap = deviceLibraryService.getAllDeviceMap();
TaskBto taskBto = taskService.get(taskId);
Integer bussinessType = taskBto.getBusinessType();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论