提交 57d6aadc authored 作者: 邓砥奕's avatar 邓砥奕

新增维修,装备使用报告

上级 610d016b
...@@ -237,6 +237,6 @@ public class DeviceLibraryController { ...@@ -237,6 +237,6 @@ public class DeviceLibraryController {
public ResponseEntity selectNewChangeDevice(@PathVariable("id") int id) { public ResponseEntity selectNewChangeDevice(@PathVariable("id") int id) {
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(id); DeviceLibrary deviceLibrary = deviceLibraryService.getOne(id);
List<DeviceLibrary> deviceLibraries = deviceLibraryDao.getAllByTypeAndNameAndModel(deviceLibrary.getType(), deviceLibrary.getName(), deviceLibrary.getModel()); List<DeviceLibrary> deviceLibraries = deviceLibraryDao.getAllByTypeAndNameAndModel(deviceLibrary.getType(), deviceLibrary.getName(), deviceLibrary.getModel());
return ResultUtil.success(deviceLibraries); return ResultUtil.success(deviceLibraries.stream().filter(deviceLibrary1 -> !deviceLibrary1.getId().equals(id)&&deviceLibrary1.getLifeStatus()==2).collect(Collectors.toList()));
} }
} }
package com.tykj.dev.device.repair.controller; package com.tykj.dev.device.repair.controller;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.repair.repository.RepairSendBillDao;
import com.tykj.dev.device.repair.service.RepairBillService; import com.tykj.dev.device.repair.service.RepairBillService;
import com.tykj.dev.device.repair.service.RepairDetailService;
import com.tykj.dev.device.repair.subject.domin.RepairBill; import com.tykj.dev.device.repair.subject.domin.RepairBill;
import com.tykj.dev.device.repair.subject.domin.RepairDetail;
import com.tykj.dev.device.repair.subject.domin.RepairSendBill;
import com.tykj.dev.device.repair.subject.vo.RepairBillSelectVo; import com.tykj.dev.device.repair.subject.vo.RepairBillSelectVo;
import com.tykj.dev.device.task.subject.common.RepairStatusEnum;
import com.tykj.dev.misc.utils.ResultUtil; import com.tykj.dev.misc.utils.ResultUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -26,6 +33,16 @@ public class RepairBillSelectController { ...@@ -26,6 +33,16 @@ public class RepairBillSelectController {
@Autowired @Autowired
private RepairBillService repairBillService; private RepairBillService repairBillService;
@Autowired
private RepairSendBillDao repairSendBillDao;
@Autowired
private DeviceLibraryService deviceLibraryService;
@Autowired
private RepairDetailService repairDetailService;
@ApiOperation(value = "查询维修单", notes = "可以通过这个接口查询维修单") @ApiOperation(value = "查询维修单", notes = "可以通过这个接口查询维修单")
@PostMapping(value = "/archives/repair/summary") @PostMapping(value = "/archives/repair/summary")
public ResponseEntity selectRepairBill(@RequestBody RepairBillSelectVo repairBillSelectVo) { public ResponseEntity selectRepairBill(@RequestBody RepairBillSelectVo repairBillSelectVo) {
...@@ -38,6 +55,55 @@ public class RepairBillSelectController { ...@@ -38,6 +55,55 @@ public class RepairBillSelectController {
List<Object> list = new ArrayList<>(); List<Object> list = new ArrayList<>();
//获取维修单 //获取维修单
RepairBill repairBill = repairBillService.getOne(id); RepairBill repairBill = repairBillService.getOne(id);
return null; list.add(repairBill);
//获取装备列表
RepairSendBill repairSendBill = repairSendBillDao.findByDeviceRepairBillId(repairBill.getId());
list.add(repairSendBill);
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
if (repairSendBill.getRepairReciveCheckDetail()!=null) {
String[] strings1 = repairSendBill.getRepairReciveCheckDetail().split("x");
for (String s : strings1) {
if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) {
Integer deviceId = Integer.parseInt(s.substring(0, s.length() - 1));
Integer checkResult = Integer.parseInt(s.substring(s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(deviceId);
deviceLibraryEntity.setCheckResult(checkResult);
deviceLibraries.add(deviceLibraryEntity);
}
}
}
//获取维修详情
List<RepairDetail> repairDetails = getRepairDetail(repairBill.getId());
//设置装备备注
deviceLibraries.forEach(deviceLibrary -> {
for (RepairDetail r:repairDetails) {
if (r.getDeviceId().equals(deviceLibrary.getId())){
deviceLibrary.setRemark(r.getRemark());
}
}
});
list.add(deviceLibraries);
return ResponseEntity.ok(list);
}
/**
* @param repairBillId 维修单id
* @return 维修详情列表
* 根据维修单Id查询维修详情,排序返回
*/
private List<RepairDetail> getRepairDetail(int repairBillId){
List<RepairDetail> repairDetails = repairDetailService.findByBillId(repairBillId);
List<RepairDetail> orderList = new ArrayList<>();
repairDetails.forEach(repairDetail -> {
if (!repairDetail.getRepairStatus().equals(RepairStatusEnum.CHANGE_NEW.id)) {
orderList.add(repairDetail);
if (repairDetail.getRepairStatus().equals(RepairStatusEnum.SCRAPPED.id)) {
if (repairDetail.getNewDeviceDetailId()!=null&&repairDetail.getNewDeviceDetailId() > 0) {
orderList.add(repairDetailService.getOne(repairDetail.getNewDeviceDetailId()));
}
}
}
});
return orderList;
} }
} }
...@@ -862,9 +862,12 @@ public class RepairController { ...@@ -862,9 +862,12 @@ public class RepairController {
Integer oldStatus = repairDetail1.getRepairStatus(); Integer oldStatus = repairDetail1.getRepairStatus();
//修改当前任务维修详情单该装备状态 //修改当前任务维修详情单该装备状态
repairDetail1.setRepairStatus(repairStatusChangeVo.getNewStatus()); repairDetail1.setRepairStatus(repairStatusChangeVo.getNewStatus());
//如果修改为已报废,更改新装备详情id为0 //如果修改为已报废,更改新装备详情id为0,,更新装备状态
if (repairStatusChangeVo.getNewStatus()==4){ if (repairStatusChangeVo.getNewStatus()==4){
repairDetail1.setNewDeviceDetailId(0); repairDetail1.setNewDeviceDetailId(0);
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(repairDetail1.getDeviceId());
deviceLibrary.setLifeStatus(5);
deviceLibraryService.update(deviceLibrary);
} }
deviceRepairDetailService.update(repairDetail1); deviceRepairDetailService.update(repairDetail1);
//修改父任务中所有维修详情单中的该装备的状态 //修改父任务中所有维修详情单中的该装备的状态
...@@ -901,23 +904,31 @@ public class RepairController { ...@@ -901,23 +904,31 @@ public class RepairController {
//获取换新装备 //获取换新装备
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(changeNewDeviceVo.getDeviceId()); DeviceLibrary deviceLibrary = deviceLibraryService.getOne(changeNewDeviceVo.getDeviceId());
//判断当前装备是否已报废 //判断当前装备是否已报废
if(repairDetail1.getNewDeviceDetailId()==0){ if(repairDetail1.getNewDeviceDetailId()!=null&&repairDetail1.getNewDeviceDetailId()==0){
//添加新的维修装备详情 //添加新的维修装备详情
RepairDetail repairDetail = new RepairDetail(); RepairDetail repairDetail = new RepairDetail();
BeanUtils.copyProperties(repairDetail1,repairDetail); repairDetail.setModel(deviceLibrary.getModel());
repairDetail.setName(deviceLibrary.getName());
repairDetail.setType(deviceLibrary.getType());
repairDetail.setDeviceRepairBillId(repairDetail1.getDeviceRepairBillId());
repairDetail.setOwnUnit(repairDetail1.getOwnUnit());
repairDetail.setLocationUnit(repairDetail1.getLocationUnit());
repairDetail.setRepairStatus(RepairStatusEnum.CHANGE_NEW.id); repairDetail.setRepairStatus(RepairStatusEnum.CHANGE_NEW.id);
repairDetail.setDeviceId(changeNewDeviceVo.getDeviceId()); repairDetail.setDeviceId(changeNewDeviceVo.getDeviceId());
repairDetail.setNewDeviceDetailId(null); repairDetail.setNewDeviceDetailId(null);
repairDetail.setRfidSurfaceId(deviceLibrary.getRfidSurfaceId()); repairDetail.setRfidSurfaceId(deviceLibrary.getRfidSurfaceId());
repairDetail.setSeqNumber(deviceLibrary.getSeqNumber()); repairDetail.setSeqNumber(deviceLibrary.getSeqNumber());
//当前业务和父任务添加该详情 //当前业务和父任务添加该详情
deviceRepairDetailService.save(repairDetail); RepairDetail repairDetail8 = deviceRepairDetailService.save(repairDetail);
repairDetail1.setNewDeviceDetailId(repairDetail8.getId());
deviceRepairDetailService.update(repairDetail1);
fathers.forEach(integer -> { fathers.forEach(integer -> {
RepairBill repairBill = deviceRepairBillService.getOne(taskService.get(integer).getBillId()); RepairBill repairBill = deviceRepairBillService.getOne(taskService.get(integer).getBillId());
RepairDetail repairDetail2 = new RepairDetail(); RepairDetail repairDetail2 = new RepairDetail();
BeanUtils.copyProperties(repairDetail,repairDetail2); BeanUtils.copyProperties(repairDetail,repairDetail2);
repairDetail2.setId(null); repairDetail2.setId(null);
repairDetail2.setDeviceRepairBillId(repairBill.getId()); repairDetail2.setDeviceRepairBillId(repairBill.getId());
deviceRepairDetailService.save(repairDetail2);
}); });
//改变装备的所属 //改变装备的所属
deviceLibrary.setOwnUnit(repairDetail.getOwnUnit()); deviceLibrary.setOwnUnit(repairDetail.getOwnUnit());
...@@ -942,10 +953,19 @@ public class RepairController { ...@@ -942,10 +953,19 @@ public class RepairController {
//获取装备列表 //获取装备列表
RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(repairBill.getId()); RepairSendBill repairSendBill = deviceRepairSendBillDao.findByDeviceRepairBillId(repairBill.getId());
repairBillDetailVo.setRepairSendBill(repairSendBill); repairBillDetailVo.setRepairSendBill(repairSendBill);
List<Integer> ids = StringSplitUtil.split(repairSendBill.getRepairDeviceCheckDetail()); List<DeviceLibrary> deviceLibraries = new ArrayList<>();
List<DeviceLibrary> deviceLibraries = ids.stream() if (repairSendBill.getRepairDeviceCheckDetail()!=null) {
.map(integer -> deviceLibraryService.getOne(integer)) String[] strings1 = repairSendBill.getRepairDeviceCheckDetail().split("x");
.collect(Collectors.toList()); for (String s : strings1) {
if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) {
Integer deviceId = Integer.parseInt(s.substring(0, s.length() - 1));
Integer checkResult = Integer.parseInt(s.substring(s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(deviceId);
deviceLibraryEntity.setCheckResult(checkResult);
deviceLibraries.add(deviceLibraryEntity);
}
}
}
//获取维修详情 //获取维修详情
List<RepairDetail> repairDetails = getRepairDetail(repairBill.getId()); List<RepairDetail> repairDetails = getRepairDetail(repairBill.getId());
repairBillDetailVo.setRepairDetails(repairDetails); repairBillDetailVo.setRepairDetails(repairDetails);
...@@ -957,6 +977,27 @@ public class RepairController { ...@@ -957,6 +977,27 @@ public class RepairController {
} }
} }
}); });
if (repairSendBill.getRepairReciveCheckDetail()!=null){
List<DeviceLibrary> deviceLibraries1 = new ArrayList<>();
String[] strings = repairSendBill.getRepairReciveCheckDetail().split("x");
for (String s : strings) {
if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) {
Integer deviceId = Integer.parseInt(s.substring(0, s.length() - 1));
Integer checkResult = Integer.parseInt(s.substring(s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(deviceId);
deviceLibraryEntity.setCheckResult(checkResult);
deviceLibraries1.add(deviceLibraryEntity);
}
}
deviceLibraries1.forEach(deviceLibrary -> {
for (RepairDetail r:repairDetails) {
if (r.getDeviceId().equals(deviceLibrary.getId())){
deviceLibrary.setRemark(r.getRemark());
}
}
});
repairBillDetailVo.setReceiveDevices(deviceLibraries1);
}
repairBillDetailVo.setDeviceLibraries(deviceLibraries); repairBillDetailVo.setDeviceLibraries(deviceLibraries);
break; break;
case 10: case 10:
...@@ -974,11 +1015,19 @@ public class RepairController { ...@@ -974,11 +1015,19 @@ public class RepairController {
if (repairBackBill.getReceiveUserbId()!=null){ if (repairBackBill.getReceiveUserbId()!=null){
repairBackBill.setReceiveUserB(userPublicService.getOne(repairBackBill.getReceiveUserbId()).getName()); repairBackBill.setReceiveUserB(userPublicService.getOne(repairBackBill.getReceiveUserbId()).getName());
} }
//获取装备列表 List<DeviceLibrary> deviceLibraryList = new ArrayList<>();
List<Integer> integers = StringSplitUtil.split(repairBackBill.getBackCheckDetail()); if (repairBackBill.getBackCheckDetail()!=null) {
List<DeviceLibrary> deviceLibraryList = integers.stream() String[] strings1 = repairBackBill.getBackCheckDetail().split("x");
.map(integer -> deviceLibraryService.getOne(integer)) for (String s : strings1) {
.collect(Collectors.toList()); if (s.length() >= 2 && "1".equals(s.substring(s.length() - 1))) {
Integer deviceId = Integer.parseInt(s.substring(0, s.length() - 1));
Integer checkResult = Integer.parseInt(s.substring(s.length() - 1));
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(deviceId);
deviceLibraryEntity.setCheckResult(checkResult);
deviceLibraryList.add(deviceLibraryEntity);
}
}
}
//获取维修详情 //获取维修详情
List<RepairDetail> repairDetailList = getRepairDetail(repairBackBill.getDeviceRepairBillId()); List<RepairDetail> repairDetailList = getRepairDetail(repairBackBill.getDeviceRepairBillId());
repairBillDetailVo.setRepairDetails(repairDetailList); repairBillDetailVo.setRepairDetails(repairDetailList);
......
...@@ -34,4 +34,7 @@ public class RepairBillDetailVo { ...@@ -34,4 +34,7 @@ public class RepairBillDetailVo {
@ApiModelProperty(name = "装备维修状态列表") @ApiModelProperty(name = "装备维修状态列表")
private List<RepairDetail> repairDetails; private List<RepairDetail> repairDetails;
@ApiModelProperty(name = "接收装备信息")
private List<DeviceLibrary> receiveDevices;
} }
...@@ -84,7 +84,12 @@ public enum BusinessEnum { ...@@ -84,7 +84,12 @@ public enum BusinessEnum {
/** /**
* 标签修改 * 标签修改
*/ */
TAG(20,"标签修改"); TAG(20,"标签修改"),
/**
* 工作交接
*/
WORK_HANDOVER(21,"工作交接")
;
public Integer id; public Integer id;
......
package com.tykj.dev.device.usereport.controller; package com.tykj.dev.device.usereport.controller;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.file.entity.WrodParameter;
import com.tykj.dev.device.usereport.service.DeviceUseReportService; import com.tykj.dev.device.usereport.service.DeviceUseReportService;
import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport; import com.tykj.dev.device.usereport.subject.domin.DeviceUseReport;
import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportCreateVo; import com.tykj.dev.device.usereport.subject.vo.DeviceUseReportCreateVo;
...@@ -16,7 +17,9 @@ import org.springframework.data.domain.Page; ...@@ -16,7 +17,9 @@ import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author dengdiyi * @author dengdiyi
...@@ -67,7 +70,15 @@ public class DeviceUseReportController { ...@@ -67,7 +70,15 @@ public class DeviceUseReportController {
@ApiOperation(value = "装备使用报告下载", notes = "装备使用报告下载") @ApiOperation(value = "装备使用报告下载", notes = "装备使用报告下载")
@GetMapping("/download/{id}") @GetMapping("/download/{id}")
public ResponseEntity getDownloadUrl(@PathVariable("id") int id){ public ResponseEntity getDownloadUrl(@PathVariable("id") int id){
DeviceUseReport d = deviceUseReportService.getOne(id); DeviceUseReportDetailVo deviceUseReportDetailVo = (DeviceUseReportDetailVo)selectDetail(id).getBody();
WrodParameter wrodParameter = new WrodParameter();
Calendar calendar = Calendar.getInstance();
calendar.setTime(Objects.requireNonNull(deviceUseReportDetailVo).getCreateTime());
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(calendar.get(Calendar.YEAR)).append("年").append(calendar.get(Calendar.MONTH)).append("月").append(calendar.get(Calendar.DAY_OF_MONTH)).append("日");
wrodParameter.setTime(stringBuffer.toString());
wrodParameter.setUnitsName(deviceUseReportDetailVo.getUnit());
wrodParameter.setTotal(deviceUseReportDetailVo.getDeviceNumber().toString());
return null; return null;
} }
} }
...@@ -11,6 +11,8 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary; ...@@ -11,6 +11,8 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo; import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.packing.repository.PackingLibraryDao; import com.tykj.dev.device.packing.repository.PackingLibraryDao;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary; import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.subject.domin.RepairDetail;
import com.tykj.dev.device.sendback.repository.SendBackBillDetailDao; import com.tykj.dev.device.sendback.repository.SendBackBillDetailDao;
import com.tykj.dev.device.sendback.subject.domin.SendBackBillDetail; import com.tykj.dev.device.sendback.subject.domin.SendBackBillDetail;
import com.tykj.dev.device.storage.repository.StorageBillDao; import com.tykj.dev.device.storage.repository.StorageBillDao;
...@@ -68,6 +70,9 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService { ...@@ -68,6 +70,9 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
@Autowired @Autowired
private PackingLibraryDao packingLibraryDao; private PackingLibraryDao packingLibraryDao;
@Autowired
private RepairDetailDao repairDetailDao;
@Override @Override
public DeviceUseReport addEntity(DeviceUseReport deviceUseReportEntity) { public DeviceUseReport addEntity(DeviceUseReport deviceUseReportEntity) {
return deviceUseReportDao.save(deviceUseReportEntity); return deviceUseReportDao.save(deviceUseReportEntity);
...@@ -202,7 +207,11 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService { ...@@ -202,7 +207,11 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
sendBackNum = sendBackNum + s.getSendedCount(); sendBackNum = sendBackNum + s.getSendedCount();
} }
} }
// ToDo 维修数量 //维修数量
List<RepairDetail> repairDetails = repairDetailDao.findAll().stream()
.filter(repairDetail -> repairDetail.getOwnUnit().equals(userUtils.getCurrentUserUnitName())&&repairDetail.getRepairStatus()!=3&&repairDetail.getCreateTime().after(date)&&repairDetail.getCreateTime().before(date2))
.collect(Collectors.toList());
repairNum = repairDetails.size();
//拼接组合字段 //拼接组合字段
deviceUseReportEntity.setReportDetail(num+"x"+inLibraryNum+"x"+repairNum+"x"+allotNum+"x"+sendBackNum+"x"+destoryNum+"x"+packingNum+"x"+retiredNum+"x"); deviceUseReportEntity.setReportDetail(num+"x"+inLibraryNum+"x"+repairNum+"x"+allotNum+"x"+sendBackNum+"x"+destoryNum+"x"+packingNum+"x"+retiredNum+"x");
return deviceUseReportDao.save(deviceUseReportEntity); return deviceUseReportDao.save(deviceUseReportEntity);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论