提交 03caa782 authored 作者: 邓砥奕's avatar 邓砥奕

更新

上级 0268c8b6
......@@ -389,9 +389,9 @@ public class AllotBillController {
allotBill1.setAllotStatus(0);
AllotBill allotBill = allotBillService.addEntity(allotBill1);
//发起任务
TaskBto taskBto = new TaskBto(StatusEnum.ALLOT_DRAFT.id, "配发业务", null, ".", allotBill.getId(), 3, userUtils.getCurrentUnitId(), 1, null, userIds);
taskService.start(taskBto);
return ResponseEntity.ok("保存成功");
TaskBto taskBto = new TaskBto(StatusEnum.ALLOT_DRAFT.id, "配发业务", null, ".", allotBill.getId(), 3, userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto taskBto1 = taskService.start(taskBto);
return ResponseEntity.ok("保存成功"+taskBto1.getId());
}
else {
//更新账单
......
......@@ -45,7 +45,7 @@ public class AllotBillSaveVo {
@ApiModelProperty(value = "发件方(B岗位)")
private Integer sendUserbId;
@NotNull(message = "receiveUseraId不能为空")
// @NotNull(message = "receiveUseraId不能为空")
@Min(value = 1,message = "receiveUseraId不能小于1")
@ApiModelProperty(value = "收件方(A岗位)")
private Integer receiveUseraId;
......
......@@ -63,6 +63,18 @@ public class DeviceLibraryController {
return ResponseEntity.ok(deviceLibraries);
}
@ApiOperation(value = "根据装备id查询装备详情", notes = "根据装备id查询装备详情")
@PostMapping("/selectRepairDeviceByIds")
public ResponseEntity selectByIds2(@RequestBody List<Detail> ids){
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
ids.forEach(detail -> {
DeviceLibrary d = deviceLibraryService.getOne(detail.getDeviceId());
d.setDetailId(detail.getId());
deviceLibraries.add(d);
});
return ResponseEntity.ok(deviceLibraries);
}
@ApiOperation(value = "模糊查询装备分页", notes = "可以通过这个接口查询装备")
@PostMapping("/selectDevicePage")
public ResponseEntity selectDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
......
......@@ -55,5 +55,7 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
List<DeviceLibrary> getAllByPackingId(Integer packingId);
List<DeviceLibrary> getAllBySeqNumber(String seq);
boolean existsAllByPackingIdInAndOwnUnitIn(List<Integer> packingIds,List<String> unitNames);
}
......@@ -207,6 +207,9 @@ public class DeviceLibrary {
@Transient
private Integer repairStatus;
@Transient
private Integer detailId;
@ApiModelProperty(value = "区块链记录id")
private String recordId;
......
......@@ -30,13 +30,17 @@ public enum RepairStatusEnum {
*/
SCRAPPED(4, "已报废"),
/**
* 已领取
* 已领取入库
*/
RECEIVED(5, "已领取"),
RECEIVED(5, "已领取入库"),
/**
* 新装备换新
*/
CHANGE_NEW_DEVICE(6, "新装备换新");
CHANGE_NEW_DEVICE(6, "新装备换新"),
/**
* 已领取待入库
*/
RECEIVE_WAIT_STORAGE(7, "已领取待入库");
public Integer id;
......
......@@ -7,7 +7,6 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.packing.service.PackingLibraryService;
import com.tykj.dev.device.packing.subject.domin.PackingLibrary;
import com.tykj.dev.device.packing.subject.vo.*;
import com.tykj.dev.misc.utils.PageUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -236,6 +235,14 @@ public class PackingLibraryController {
return ResultUtil.success(packingLibraryService.getPackingDetail(id));
}
@ApiOperation(value = "查询多个列装详情", notes = "可以通过这个接口查询多个列装详情")
@GetMapping("/selectMoreDetail/")
public ResponseEntity selectMorePackingDetail(@RequestBody List<Integer> ids) {
List<PackingLibrary> packingLibraries = new ArrayList<>();
ids.forEach(integer -> packingLibraries.add(packingLibraryService.getOne(integer)));
return ResultUtil.success(packingLibraries);
}
@ApiOperation(value = "查询退装详情页", notes = "可以通过这个接口查询存在的类型")
@GetMapping("/retired/detail/{id}")
public ResponseEntity selectInvalidDetail(@PathVariable("id") @Min(value = 1,message = "id不能小于1") int id) {
......
......@@ -206,6 +206,9 @@ public class PackingLibrary {
@ApiModelProperty(value = "预分配的装备序列号")
@Transient
private String seq;
@ApiModelProperty(value = "预分配的生产序列号")
@Transient
private String prodNumber;
public void addChildNode(PackingLibrary packingLibraryEntity) {
childs.add(packingLibraryEntity);
......
......@@ -29,11 +29,13 @@ 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.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.User;
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;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.RepairStatusEnum;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.Snowflake;
import com.tykj.dev.misc.utils.StringSplitUtil;
......@@ -117,6 +119,9 @@ public class RepairController {
@Autowired
private MessageService messageService;
@Autowired
private UnitsService unitsService;
@ApiOperation(value = "发起维修", notes = "可以通过这个接口发起维修")
@PostMapping(value = "/form")
@Transactional(rollbackFor = Exception.class)
......@@ -170,6 +175,11 @@ public class RepairController {
}
//存维修详情单
for (DeviceDetailVo d : repairBillSaveVo.getDeviceList()) {
if (d.getId()!=null){
RepairDetail repairDetail = deviceRepairDetailService.getOne(d.getId());
repairDetail.setRepairStatus(2);
deviceRepairDetailService.update(repairDetail);
}
stringBuffer.append(d.getDeviceId());
stringBuffer.append("Ǵ");
stringBuffer.append(d.getRemark());
......@@ -442,7 +452,7 @@ public class RepairController {
//存接收无误的装备id
List<Integer> idList = new ArrayList<>();
for (String s : strings) {
if (s.length() > 2) {
if (s.length() >= 2) {
//接收无误
if ("1".equals(s.substring(s.length() - 1))) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
......@@ -671,6 +681,7 @@ public class RepairController {
for (DeviceDetailVo d : repairBackBillSaveVo.getDeviceList()) {
RepairDetail repairDetail = deviceRepairDetailService.getOne(d.getId());
repairDetail.setRepairBackBillId(deviceRepairBackBillEntity1.getId());
repairDetail.setRepairStatus(7);
deviceRepairDetailService.update(repairDetail);
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(d.getDeviceId());
deviceLibraryEntity.setLifeStatus(3);
......@@ -784,15 +795,17 @@ public class RepairController {
@Transactional(rollbackFor = Exception.class)
public ResponseEntity backReceive(@RequestBody @Validated RepairReceiveVo repairReceiveVo) {
//获取当前任务
TaskBto taskBto = taskService.get(repairReceiveVo.getTaskId());
TaskBto taskBto;
Integer userId = userUtils.getCurrentUserId();
Integer level = userUtils.getCurrentUnitLevel();
taskService.addInvolveUser(taskBto,userId);
//获取退回单和装备id
RepairBackBill repairBackBill;
if (level == 2 || level == 3) {
taskBto = taskService.get(repairReceiveVo.getTaskId());
taskService.addInvolveUser(taskBto,userId);
repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId());
} else {
taskBto = new TaskBto();
// //判断是否修完
// List<RepairDetail> deviceRepairDetailEntities = deviceRepairDetailService.findByBillId(taskBto.getBillId());
// //获取所有装备的维修状态
......@@ -852,6 +865,12 @@ public class RepairController {
TaskBto taskBto1 = new TaskBto(StatusEnum.WAIT_UPLOAD_BACK_FILE.id, "维修退回", null, ".", repairBackBill1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 1, null, userIds);
taskBto2 = taskService.start(taskBto1);
}
for (DeviceDetailVo d : repairReceiveVo.getDeviceList()) {
RepairDetail repairDetail = deviceRepairDetailService.getOne(d.getId());
repairDetail.setRepairBackBillId(repairBackBill1.getId());
repairDetail.setRepairStatus(5);
deviceRepairDetailService.update(repairDetail);
}
//添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(taskBto2.getId(), "维修退回装备接收并发起入库", fileVoList);
// taskLogService.addLog(taskLogBto2);
......@@ -864,10 +883,18 @@ public class RepairController {
else {
taskBto2 = taskService.moveToSpecial(taskBto,StatusEnum.WAIT_UPLOAD_BACK_FILE);
}
//获取维修详情
List<RepairDetail> repairDetailList = repairDetailDao.findByRepairBackBillId(repairBackBill.getId());
repairDetailList.forEach(repairDetail -> {
// repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
repairDetail.setRepairStatus(5);
deviceRepairDetailService.update(repairDetail);
});
}
// TaskBto parent = taskService.get(taskBto2.getParentTaskId());
String[] strings = deviceIdDetail.split("x");
//存放正常接收的装备id
Set<String> units = new HashSet<>();
List<Integer> idList = new ArrayList<>();
for (String s : strings) {
if (s.length() > 1) {
......@@ -877,6 +904,13 @@ public class RepairController {
idList.add(id);
//更改装备状态
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
Integer unitId = userPublicService.findUnitIdByName(deviceLibraryEntity.getOwnUnit());
if (userUtils.getCurrentUnitLevel()==1&&unitsService.findById(unitId).getLevel()==3) {
units.add(unitsService.findByAreaId(unitId).getName());
}
else {
units.add(deviceLibraryEntity.getOwnUnit());
}
deviceLibraryEntity.setLifeStatus(2);
deviceLibraryEntity.setLocationUnit(userUtils.getCurrentUserUnitName());
//添加装备日志
......@@ -897,8 +931,8 @@ public class RepairController {
}
}
}
// //获取维修详情
// List<RepairDetail> repairDetailList = deviceRepairDetailService.findByBillId(parent.getBillId());
//获取维修详情
// List<RepairDetail> repairDetailList = repairDetailDao.findByRepairBackBillId(repairBackBill.getId());
// //获取所有父业务id
// List<Integer> fathers = StringSplitUtil.taskIdSplit(parent.getNodeIdDetail());
// fathers.forEach(integer -> {
......@@ -913,19 +947,26 @@ public class RepairController {
// });
// //改变维修详情装备所在单位为当前单位
// repairDetailList.forEach(repairDetail -> {
// repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
//// repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
// repairDetail.setRepairStatus(5);
// deviceRepairDetailService.update(repairDetail);
// });
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
List<Integer> ids2 = new ArrayList<>();
units.forEach(s -> ids2.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(s)).stream()
.map(User::getUserId)
.collect(Collectors.toList())));
if (level>1) {
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit())).stream()
ids.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getSendUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
}
MessageBto messageBto = new MessageBto(taskBto2.getId(),taskBto2.getBusinessType(),repairBackBill.getReceiveUnit()+"接收维修退回装备",ids);
messageService.add(messageBto);
MessageBto messageBto2 = new MessageBto(taskBto2.getId(),taskBto2.getBusinessType(),"待领取送修装备",ids2);
messageService.add(messageBto2);
myWebSocket.sendMessage1();
return ResultUtil.success("维修成功退回装备接收入库");
}
......@@ -1033,9 +1074,9 @@ public class RepairController {
@Transactional(rollbackFor = Exception.class)
public ResponseEntity changeRepairDeviceStatus(@RequestBody @Validated RepairStatusChangeVo repairStatusChangeVo) {
//获取当前任务
TaskBto taskBto = taskService.get(repairStatusChangeVo.getTaskId());
// TaskBto taskBto = taskService.get(repairStatusChangeVo.getTaskId());
//获取所有父任务id
List<Integer> fathers = StringSplitUtil.taskIdSplit(taskBto.getNodeIdDetail());
// List<Integer> fathers = StringSplitUtil.taskIdSplit(taskBto.getNodeIdDetail());
for (Integer id : repairStatusChangeVo.getId()) {
//获取维修详情单
RepairDetail repairDetail1 = deviceRepairDetailService.getOne(id);
......@@ -1052,16 +1093,16 @@ public class RepairController {
}
deviceRepairDetailService.update(repairDetail1);
//修改父任务中所有维修详情单中的该装备的状态
if (fathers.size() > 0) {
fathers.forEach(integer -> {
deviceRepairDetailService.findByBillId(integer).stream()
.filter(repairDetail -> repairDetail.getDeviceId().equals(repairDetail1.getDeviceId()))
.forEach(repairDetail -> {
repairDetail.setRepairStatus(repairStatusChangeVo.getNewStatus());
deviceRepairDetailService.update(repairDetail);
});
});
}
// if (fathers.size() > 0) {
// fathers.forEach(integer -> {
// deviceRepairDetailService.findByBillId(integer).stream()
// .filter(repairDetail -> repairDetail.getDeviceId().equals(repairDetail1.getDeviceId()))
// .forEach(repairDetail -> {
// repairDetail.setRepairStatus(repairStatusChangeVo.getNewStatus());
// deviceRepairDetailService.update(repairDetail);
// });
// });
// }
//获取装备名称
String deviceName = deviceLibraryService.getOne(repairDetail1.getDeviceId()).getName();
//添加业务日志
......@@ -1072,11 +1113,19 @@ public class RepairController {
}
String remark = "将装备" + deviceName + "状态由" + GlobalMap.getRepairStatusMap().get(oldStatus).name + "改为" + GlobalMap.getRepairStatusMap().get(repairStatusChangeVo.getNewStatus()).name;
//业务日志
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), remark, fileVos);
taskLogService.addLog(taskLogBto);
// TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), remark, fileVos);
// taskLogService.addLog(taskLogBto);
//装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(repairDetail1.getDeviceId(), remark, fileVos);
deviceLogService.addLog(deviceLogDto);
if (repairStatusChangeVo.getNewStatus()==2) {
List<Integer> ids2 = new ArrayList<>();
ids2.addAll(userDao.findAllByUnitsId(userPublicService.getOne(repairDetail1.getCreateUserId()).getUnitsId()).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto2 = new MessageBto(0, 0, "待领取送修装备", ids2);
messageService.add(messageBto2);
}
}
return ResultUtil.success("修改成功");
}
......@@ -1289,6 +1338,64 @@ public class RepairController {
return ResultUtil.success(repairBillDetailVo);
}
@ApiOperation(value = "查询维修管理列表", notes = "可以通过这个接口查询维修管理列表")
@GetMapping(value = "/repairList/{type}")
public ResponseEntity getRepairList(@PathVariable("type") int type) {
Integer userId = userUtils.getCurrentUserId();
String unitName = userUtils.getCurrentUserUnitName();
//待维修装备
if (type==1){
List<RepairDetail> repairDetails = repairDetailDao.findAllByRepairStatus(1);
repairDetails.forEach(repairDetail -> {
repairDetail.setLocationUnit(deviceLibraryService.getOne(repairDetail.getDeviceId()).getLocationUnit());
deviceRepairDetailService.update(repairDetail);
});
return ResponseEntity.ok(repairDetails.stream().filter(repairDetail -> repairDetail.getLocationUnit().equals(unitName)).sorted(Comparator.comparing(RepairDetail::getOwnUnit)).collect(Collectors.toList()));
}
//送修装备
else if(type==2){
List<RepairDetail> repairDetails = repairDetailDao.findAllByRepairStatus(5);
// repairDetails.addAll(repairDetailDao.findAllByRepairStatus(5));
List<RepairDetail> repairDetails1 = repairDetailDao.findAll();
repairDetails1.removeAll(repairDetails);
repairDetails1.forEach(repairDetail -> {
repairDetail.setLocationUnit(deviceLibraryService.getOne(repairDetail.getDeviceId()).getLocationUnit());
deviceRepairDetailService.update(repairDetail);
});
return ResponseEntity.ok(repairDetails1.stream().filter(repairDetail -> userPublicService.findUnitsNameByUserId(repairDetail.getCreateUserId()).equals(unitName)).sorted(Comparator.comparing(RepairDetail::getOwnUnit)).collect(Collectors.toList()));
}
//待领取装备
else if(type==3){
List<RepairDetail> repairDetails = repairDetailDao.findAllByRepairStatus(2);
repairDetails.forEach(repairDetail -> {
repairDetail.setLocationUnit(deviceLibraryService.getOne(repairDetail.getDeviceId()).getLocationUnit());
deviceRepairDetailService.update(repairDetail);
});
return ResponseEntity.ok(repairDetails.stream().filter(repairDetail -> repairDetail.getLocationUnit().equals(unitName)).sorted(Comparator.comparing(RepairDetail::getOwnUnit)).collect(Collectors.toList()));
}
else {
throw new ApiException("type只能为1,2,3");
}
}
@ApiOperation(value = "上传维修记录备注", notes = "可以通过这个接口上传维修记录备注")
@PostMapping(value = "/uploadRecord")
public ResponseEntity uploadRecord(@RequestBody RepairRecord repairRecord) {
Integer level = userUtils.getCurrentUnitLevel();
RepairDetail repairDetail = deviceRepairDetailService.getOne(repairRecord.getId());
if (level==1) {
repairDetail.setRecord(repairRecord.getRecord());
}
else if (level==2) {
repairDetail.setRecord2(repairRecord.getRecord());
}
else if (level==3) {
repairDetail.setRecord3(repairRecord.getRecord());
}
deviceRepairDetailService.update(repairDetail);
return ResponseEntity.ok("更新成功");
}
/**
* @param repairBillId 维修单id
* @return 维修详情列表
......
......@@ -9,4 +9,6 @@ import java.util.List;
public interface RepairDetailDao extends JpaRepository<RepairDetail, Integer>, JpaSpecificationExecutor<RepairDetail> {
List<RepairDetail> findByDeviceRepairBillId(Integer billId);
List<RepairDetail> findByRepairBackBillId(Integer billId);
List<RepairDetail> findAllByRepairStatusAndOwnUnit(Integer repairStatus,String ownUnit);
List<RepairDetail> findAllByRepairStatus(Integer repairStatus);
}
......@@ -134,5 +134,11 @@ public class RepairDetail {
@ApiModelProperty(value = "维修记录信息")
private String record;
@ApiModelProperty(value = "维修记录信息")
private String record2;
@ApiModelProperty(value = "维修记录信息")
private String record3;
private Integer repairBackBillId;
}
......@@ -18,7 +18,7 @@ import javax.validation.constraints.NotNull;
@ApiModel("维修装备详情类")
public class DeviceDetailVo {
@NotNull(message = "id不能为空")
// @NotNull(message = "id不能为空")
@Min(value = 1,message = "id不能小于1")
@ApiModelProperty(value = "维修详情ID", example = "1")
private Integer id;
......
......@@ -17,7 +17,7 @@ import java.util.List;
@ApiModel("维修返回单存储类")
public class RepairBackBillSaveVo {
@NotNull(message = "taskId不能为空")
// @NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id")
private Integer taskId;
......@@ -45,11 +45,11 @@ public class RepairBackBillSaveVo {
// @ApiModelProperty(value = "接收经手人", example = "1")
// private Integer receiveUseraId;
@NotNull(message = "applyNumber不能为空")
// @NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号")
private String applyNumber;
@NotNull(message = "replayNumber不能为空")
// @NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号")
private String replayNumber;
......
......@@ -38,11 +38,11 @@ public class RepairBillSaveVo {
@ApiModelProperty(value = "维修经手人", example = "1")
private Integer repairUseraId;
@NotNull(message = "applyNumber不能为空")
// @NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号")
private String applyNumber;
@NotNull(message = "replayNumber不能为空")
// @NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号")
private String replayNumber;
......
......@@ -6,6 +6,8 @@ import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
/**
* @author dengdiyi
......@@ -19,7 +21,7 @@ public class RepairReceiveVo {
@ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId;
@NotNull(message = "taskId不能为空")
// @NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id")
private Integer taskId;
......@@ -56,4 +58,7 @@ public class RepairReceiveVo {
@NotNull(message = "status不能为空")
@ApiModelProperty(value = "是否缺失单据(0:否,1:是)")
private Integer status = 0;
@ApiModelProperty(value = "维修装备详情列表")
private List<DeviceDetailVo> deviceList = new ArrayList<>();
}
package com.tykj.dev.device.repair.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @author dengdiyi
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("维修装备详情类")
public class RepairRecord {
@Min(value = 1,message = "id不能小于1")
@ApiModelProperty(value = "维修详情ID", example = "1")
private Integer id;
@NotNull
@ApiModelProperty(value = "维修记录")
private String record;
}
......@@ -16,7 +16,7 @@ import java.util.List;
@ApiModel("装备维修状态修改类")
public class RepairStatusChangeVo {
@NotNull(message = "taskId不能为空")
// @NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(name = "业务id", value = "1")
private Integer taskId;
......
......@@ -168,8 +168,12 @@ public class SelfCheckController {
List<DeviceLibrary> deviceLibraryEntities = new ArrayList<>();
List<DeviceLibrary> newList = new ArrayList<>();
List<DeviceLibrary> resultList = new ArrayList<>();
for (Integer id : list) {
DeviceLibrary d = deviceLibraryService.getOne(id);
List<Integer> detailIds = compareVo.getDetailIdList();
for (int i = 0;i<list.size();i++) {
DeviceLibrary d = deviceLibraryService.getOne(list.get(i));
if (detailIds.size()>i){
d.setDetailId(detailIds.get(i));
}
//list1存应查装备rfid卡号
list1.add(d.getRfidCardId());
//deviceLibraryEntities存应查装备
......
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -18,4 +19,7 @@ public class CompareVo {
@ApiModelProperty(value = "二维码上传RFID列表")
private List<String> rfidResultList;
@ApiModelProperty(value = "detailid列表")
private List<Integer> detailIdList = new ArrayList<>();
}
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.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService;
......@@ -84,6 +85,12 @@ public class StorageBillController {
@ApiOperation(value = "获取序列号区间列表", notes = "可以通过这个接口获取序列号区间列表")
@GetMapping(value = "/getSeq/{num}/{string}")
public ResponseEntity getSeq(@PathVariable("string") String s,@PathVariable("num") Integer num){
List<String> strings = DeviceSeqUtil.createDeviceSeqs(s,num);
strings.forEach(s1 -> {
if (deviceLibraryDao.getAllBySeqNumber(s1).size()>0){
throw new ApiException("序列号"+s1+"已存在");
}
});
return ResultUtil.success(DeviceSeqUtil.createDeviceSeqs(s,num));
}
......@@ -94,6 +101,7 @@ public class StorageBillController {
Map<Integer, List<PackingLibrary>> map = new HashMap<>();
for (StorageBillDetailVo s : list) {
List<String> strings = DeviceSeqUtil.createDeviceSeqs(s.getSeqInterval(),s.getStorageCount());
List<String> strings3 = DeviceSeqUtil.createDeviceSeqs(s.getProdInterval(),s.getStorageCount());
List<List<String>> sons = new ArrayList<>();
int count = 1;
Integer deviceNum = s.getStorageCount();
......@@ -101,7 +109,14 @@ public class StorageBillController {
PackingLibrary packingLibraryEntity = new PackingLibrary();
BeanUtils.copyProperties(packingLibraryService.getOne(s.getPackingId()), packingLibraryEntity);
packingLibraryEntity.setCorresponding(count);
if (!strings3.isEmpty()) {
packingLibraryEntity.setProdNumber(strings3.get(0));
strings3.remove(0);
}
if (!strings.isEmpty()) {
if (deviceLibraryDao.getAllBySeqNumber(strings.get(0)).size()>0){
throw new ApiException("序列号"+strings.get(0)+"已存在");
}
packingLibraryEntity.setSeq(strings.get(0));
strings.remove(0);
}
......@@ -326,8 +341,8 @@ public class StorageBillController {
StorageBill storageBill = storageBillService.addEntity(storageBill1);
//发起任务
TaskBto taskBto = new TaskBto(StatusEnum.WAIT_STORAGE.id, "入库业务", null, ".", storageBill.getId(), 2, userUtils.getCurrentUnitId(), 0, null, userIds);
taskService.start(taskBto);
return ResponseEntity.ok("保存成功");
TaskBto taskBto1 = taskService.start(taskBto);
return ResponseEntity.ok("保存成功"+taskBto1.getId());
}
else {
//更新账单
......@@ -359,8 +374,19 @@ public class StorageBillController {
StorageBill storageBillEntity = storageBillService.getOne(taskBto.getBillId());
storageBillEntity.setReceiveUserA(userPublicService.getOne(storageBillEntity.getReceiveUseraId()).getName());
storageBillEntity.setReceiveUserB(userPublicService.getOne(storageBillEntity.getReceiveUserbId()).getName());
storageBillEntity.setStorageBillDetailVos(JacksonUtil.readValueToList(storageBillEntity.getPackingDetail(),StorageBillDetailVo.class));
storageBillEntity.getStorageBillDetailVos().forEach(storageBillDetailVo -> storageBillDetailVo.setPackingLibrary(packingLibraryService.getOne(storageBillDetailVo.getPackingId())));
List<StorageBillDetailVo> storageBillDetailVos = JacksonUtil.readValue(storageBillEntity.getPackingDetail(), new TypeReference<List<StorageBillDetailVo>>() {
});
setPackingLibrary(storageBillDetailVos);
storageBillEntity.setStorageBillDetailVos(storageBillDetailVos);
return ResponseEntity.ok(storageBillEntity);
}
private void setPackingLibrary(List<StorageBillDetailVo> storageBillDetailVos){
storageBillDetailVos.forEach(storageBillDetailVo -> {
storageBillDetailVo.setPackingLibrary(packingLibraryService.getOne(storageBillDetailVo.getPackingId()));
if (storageBillDetailVo.getList()!=null&&storageBillDetailVo.getList().size()>0){
setPackingLibrary(storageBillDetailVo.getList());
}
});
}
}
......@@ -22,6 +22,8 @@ public class StorageBillDetailVo {
private Integer storageCount;
@ApiModelProperty(value = "序列号区间")
private String seqInterval;
@ApiModelProperty(value = "生产号区间")
private String prodInterval;
@ApiModelProperty(value = "列装装备")
private PackingLibrary packingLibrary;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论