提交 0fb29fc5 authored 作者: 邓砥奕's avatar 邓砥奕

新增入库草稿

上级 ea8e2ffb
......@@ -26,9 +26,9 @@ public enum LogType {
STORAGE_1(4,STORAGE.id, ORIGIN_STATUS.id, END.id, "发起装备入库"),
STORAGE_2(5,STORAGE.id, STORAGE_CONFIRM.id, END.id, "入库审核成功"),
STORAGE_2(5,STORAGE.id, WAIT_STORAGE.id, END.id, "发起装备入库"),
STORAGE_3(6,STORAGE.id, STORAGE_CONFIRM.id, ARCHIVE.id, "入库审核失败"),
STORAGE_3(6,STORAGE.id, ORIGIN_STATUS.id, WAIT_STORAGE.id, "保存入库草稿"),
ALLOT_1(7,ALLOT.id, ORIGIN_STATUS.id, ALLOT_SEND_CONFIRM.id, "对(%receiveUnit)发起配发"),
......
......@@ -488,6 +488,9 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
if (deviceLibrarySelectVo.getPackingId() != null) {
predicateBuilder.eq("packingId", deviceLibrarySelectVo.getPackingId());
}
if (deviceLibrarySelectVo.getIsPart() != null) {
predicateBuilder.eq("isPart", deviceLibrarySelectVo.getIsPart());
}
if (deviceLibrarySelectVo.getContent() != null) {
Class<DeviceLibrary> deviceLibraryEntity = DeviceLibrary.class;
......
......@@ -25,7 +25,7 @@ public class DeviceLibrarySaveVo {
@ApiModelProperty(value = "装备序列号")
private String seqNumber;
@NotNull(message = "prodNumber不能为空")
// @NotNull(message = "prodNumber不能为空")
@ApiModelProperty(value = "生产序列号")
private String prodNumber;
......
......@@ -74,4 +74,7 @@ public class DeviceLibrarySelectVo extends CustomPage {
@ApiModelProperty(value = "rfid卡号")
private String rfidCardId;
@ApiModelProperty(value = "是不是配件(0:不是,1:是)")
private Integer isPart;
}
......@@ -116,7 +116,7 @@ public enum StatusEnum {
* 入库待审核
*/
STORAGE_CONFIRM(200, "入库待审核"),
WAIT_STORAGE(201, "待入库"),
/**
* 待配发
*/
......
......@@ -667,6 +667,8 @@ public class RepairController {
if (integerSet.size() == statusSet.size()) {
//维修主业务完结
taskService.update(taskService.moveToEnd(taskBto));
repairBill.setRepairStatus(5);
deviceRepairBillService.update(repairBill);
}
//发送阅知信息
List<Integer> ids = userPublicService.findOtherUser(userUtils.getCurrentUserId());
......
......@@ -27,6 +27,7 @@ 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.DeviceSeqUtil;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.StringSplitUtil;
import com.tykj.dev.socket.MyWebSocket;
......@@ -152,20 +153,32 @@ public class StorageBillController {
public ResponseEntity addStorageBill(@RequestBody @Validated StorageBillSaveVo storageBillSaveVo) {
//1.存入库单
Integer userId = userUtils.getCurrentUserId();
StorageBill storageBillEntity = storageBillService.addEntity(storageBillSaveVo.toDo());
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
StorageBill storageBillEntity;
TaskBto taskEntity1;
if (storageBillSaveVo.getTaskId()==null) {
storageBillEntity = storageBillService.addEntity(storageBillSaveVo.toDo());
//2.发起入库任务
TaskBto taskBto = new TaskBto(StatusEnum.END.id, "入库业务", null, ".", storageBillEntity.getId(), 2, userUtils.getCurrentUnitId(), 0, null, userIds);
taskEntity1 = taskService.start(taskBto);
}
else {
taskEntity1 = taskService.get(storageBillSaveVo.getTaskId());
StorageBill storageBill = storageBillService.getOne(taskEntity1.getBillId());
StorageBill storageBill1 = storageBillSaveVo.toDo();
storageBill1.setId(storageBill.getId());
storageBillEntity = storageBillService.update(storageBill1);
//结束Task
taskService.moveToEnd(taskEntity1);
}
Integer storageBillId = storageBillEntity.getId();
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("x");
//2.发起入库任务
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
// userIds.add(storageBillSaveVo.getReceiveUserbId());
TaskBto taskBto = new TaskBto(StatusEnum.END.id, "入库业务", null, ".", storageBillEntity.getId(), 2, userUtils.getCurrentUnitId(), 0, null, userIds);
TaskBto taskEntity1 = taskService.start(taskBto);
//存业务日志
List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("配发单", storageBillEntity.getFileName(), storageBillEntity.getFileUrl()));
fileVoList.add(new FileVo("入库确认单", storageBillEntity.getReceiveFileName(), storageBillEntity.getReceiveFileUrl()));
// fileVoList.add(new FileVo("入库确认单", storageBillEntity.getReceiveFileName(), storageBillEntity.getReceiveFileUrl()));
// //添加业务日志
// TaskLogBto taskLogBto2 = new TaskLogBto(taskEntity1.getId(), "发起装备入库", fileVoList);
// taskLogService.addLog(taskLogBto2);
......@@ -214,11 +227,17 @@ public class StorageBillController {
}
//4.更新入库单入库详情
storageBillEntity.setStorageDetail(stringBuffer.toString());
storageBillService.update(storageBillEntity);
//发送阅知信息
MessageBto messageBto = new MessageBto();
messageBto.setContent("发起装备入库");
messageBto.setTaskId(taskEntity1.getId());
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userId));
if (storageBillEntity.getReceiveUserB()==null) {
messageBto.setInvolveUserIdList(userPublicService.findOtherUser(userId));
}
else {
messageBto.setInvolveUserIdList(new ArrayList<>(Collections.singletonList(storageBillEntity.getReceiveUserbId())));
}
messageBto.setBusinessType(taskEntity1.getBusinessType());
messageService.add(messageBto);
myWebSocket.sendMessage1();
......@@ -291,4 +310,56 @@ public class StorageBillController {
storageDetailVo.setTaskLogUserVos(taskLogService.getByTaskId(taskBto.getId()));
return ResultUtil.success(storageDetailVo);
}
@ApiOperation(value = "保存入库单", notes = "可以通过这个接口保存入库单")
@PostMapping(value = "/saveStorageBill")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity saveStorageBill(@RequestBody @Validated StorageBillSaveVo storageBillSaveVo) {
//第一次保存
if (storageBillSaveVo.getTaskId()==null){
//保存入库单
Integer userId = userUtils.getCurrentUserId();
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
StorageBill storageBill1 = storageBillSaveVo.toDo();
storageBill1.setStorageStatus(0);
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("保存成功");
}
else {
//更新账单
TaskBto taskBto = taskService.get(storageBillSaveVo.getTaskId());
StorageBill storageBill = storageBillService.getOne(taskBto.getBillId());
StorageBill storageBill1 = storageBillSaveVo.toDo();
storageBill1.setId(storageBill.getId());
storageBill1.setStorageStatus(0);
storageBillService.update(storageBill1);
return ResponseEntity.ok("更新成功");
}
}
@ApiOperation(value = "删除入库单草稿", notes = "可以通过这个接口删除入库单草稿")
@PostMapping(value = "/deleteStorageBill/{taskId}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity deleteStorageBill(@PathVariable("taskId") int taskId) {
//任务封存
TaskBto taskBto = taskService.get(taskId);
taskService.moveToArchive(taskBto);
return ResponseEntity.ok("删除成功");
}
@ApiOperation(value = "查询待入库详情", notes = "可以通过这个接口查询待入库详情")
@PostMapping(value = "/selectStorageDetail/{taskId}")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity selectStorageDetail(@PathVariable("taskId") int taskId) {
TaskBto taskBto = taskService.get(taskId);
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));
return ResponseEntity.ok(storageBillEntity);
}
}
package com.tykj.dev.device.storage.subject.domin;
import com.tykj.dev.device.storage.subject.vo.StorageBillDetailVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -12,7 +13,9 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* entity class for storage_bill
......@@ -58,6 +61,10 @@ public class StorageBill {
*/
@ApiModelProperty(value = "发件方")
private String sendUserId;
/**
* 核发人
*/
private String approver;
/**
* 收件方id(A岗位)
*/
......@@ -71,7 +78,7 @@ public class StorageBill {
/**
* 入库状态(0:待审核,1:审核失败,2:已入库)
*/
@ApiModelProperty(value = "入库状态(0:待审核,1:审核失败,2:已入库)")
@ApiModelProperty(value = "入库状态(0:草稿,1:审核失败,2:已入库)")
private Integer storageStatus;
/**
* 账单文件地址URL
......@@ -146,7 +153,14 @@ public class StorageBill {
@Transient
private String receiveUserB;
@ApiModelProperty(value = "列装详情")
@Transient
private List<StorageBillDetailVo> storageBillDetailVos = new ArrayList<>();
@ApiModelProperty(value = "区块链记录id")
private String recordId;
@ApiModelProperty(value = "StorageBillDetailVo to json")
@Column(name = "packing_detail",columnDefinition = "TEXT")
private String packingDetail;
}
......@@ -2,15 +2,14 @@ package com.tykj.dev.device.storage.subject.vo;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySaveVo;
import com.tykj.dev.device.storage.subject.domin.StorageBill;
import com.tykj.dev.misc.utils.JacksonUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -20,28 +19,37 @@ import java.util.List;
@Data
@ApiModel("入库存储类")
public class StorageBillSaveVo {
@NotNull(message = "applyNumber不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id")
private Integer taskId;
// @NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号")
private String applyNumber;
@NotNull(message = "replayNumber不能为空")
// @NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号")
private String replayNumber;
@NotNull(message = "sendUnit不能为空")
// @NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "配送单位")
private String sendUnit;
@NotNull(message = "sendUserId不能为空")
// @NotNull(message = "sendUserId不能为空")
@ApiModelProperty(value = "发件方")
private String sendUserId;
@NotNull(message = "sendTime不能为空")
// @NotNull(message = "approver不能为空")
@ApiModelProperty(value = "核发人")
private String approver;
// @NotNull(message = "sendTime不能为空")
@ApiModelProperty(value = "配发时间")
private Date sendTime;
@NotNull(message = "receiveUseraId不能为空")
@Min(value = 1,message = "receiveUseraId不能小于1")
// @NotNull(message = "receiveUseraId不能为空")
// @Min(value = 1,message = "receiveUseraId不能小于1")
@ApiModelProperty(value = "接收单位A岗")
private Integer receiveUseraId;
......@@ -50,42 +58,46 @@ public class StorageBillSaveVo {
@ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId;
@NotNull(message = "fileName不能为空")
// @NotNull(message = "fileName不能为空")
@ApiModelProperty(value = "配发单附件名")
private String fileName;
@NotNull(message = "fileUrl不能为空")
// @NotNull(message = "fileUrl不能为空")
@ApiModelProperty(value = "配发单附件url")
private String fileUrl;
@NotNull(message = "receiveFileName不能为空")
// @NotNull(message = "receiveFileName不能为空")
@ApiModelProperty(value = "入库单附件名")
private String receiveFileName;
@NotNull(message = "receiveFileUrl不能为空")
// @NotNull(message = "receiveFileUrl不能为空")
@ApiModelProperty(value = "入库单附件url")
private String receiveFileUrl;
@NotNull(message = "storagingCount不能为空")
@Min(value = 1,message = "storagingCount不能小于1")
// @NotNull(message = "storagingCount不能为空")
// @Min(value = 1,message = "storagingCount不能小于1")
@ApiModelProperty(value = "待入库数量")
private Integer storagingCount;
@NotNull(message = "storagedCount不能为空")
@Min(value = 0,message = "storagedCount不能小于0")
// @NotNull(message = "storagedCount不能为空")
// @Min(value = 0,message = "storagedCount不能小于0")
@ApiModelProperty(value = "已入库数量")
private Integer storagedCount;
@Valid
@NotEmpty(message = "deviceLibrarySaveVoList不能为空")
// @Valid
// @NotEmpty(message = "deviceLibrarySaveVoList不能为空")
@ApiModelProperty(value = "入库各装备详情")
private List<DeviceLibrarySaveVo> deviceLibrarySaveVoList;
private List<DeviceLibrarySaveVo> deviceLibrarySaveVoList = new ArrayList<>();
@ApiModelProperty(value = "入库列装详情")
private List<StorageBillDetailVo> storageBillDetailVos = new ArrayList<>();
public StorageBill toDo() {
StorageBill storageBillEntity = new StorageBill();
BeanUtils.copyProperties(this, storageBillEntity);
storageBillEntity.setStorageStatus(2);
storageBillEntity.setStorageDetail("x");
storageBillEntity.setPackingDetail(JacksonUtil.toJSon(storageBillDetailVos));
return storageBillEntity;
}
}
......@@ -265,9 +265,10 @@ public class LogAspect {
if (storageBillService != null) {
StorageBill storageBill = storageBillService.getOne(outPutTask.getBillId());
getFieldsParam(storageBill);
if (this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id) && this.newStatus.equals(StatusEnum.END.id)) {
if (this.oldStatus.equals(StatusEnum.ORIGIN_STATUS.id) && this.newStatus.equals(StatusEnum.END.id)
||this.oldStatus.equals(StatusEnum.WAIT_STORAGE.id) && this.newStatus.equals(StatusEnum.END.id)) {
this.fileVos.add(new FileVo("配发单", storageBill.getFileName(), storageBill.getFileUrl()));
this.fileVos.add(new FileVo("入库确认单", storageBill.getReceiveFileName(), storageBill.getReceiveFileUrl()));
// this.fileVos.add(new FileVo("入库确认单", storageBill.getReceiveFileName(), storageBill.getReceiveFileUrl()));
}
}
break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论