|
@@ -3,9 +3,7 @@ package cn.iocoder.yudao.module.museum.controller.admin.museumflow;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowPageVO;
|
|
|
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowRespVO;
|
|
|
-import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.MuseumFlowSaveVO;
|
|
|
+import cn.iocoder.yudao.module.museum.controller.admin.museumflow.vo.*;
|
|
|
import cn.iocoder.yudao.module.museum.dal.database.museumflow.MuseumFlowDO;
|
|
|
import cn.iocoder.yudao.module.museum.dal.database.museuminfo.MuseumInfoDO;
|
|
|
import cn.iocoder.yudao.module.museum.service.museumflow.MuseumFlowService;
|
|
@@ -15,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Tag(name = "博物馆-出回库管理")
|
|
|
@RestController
|
|
@@ -52,90 +51,134 @@ public class MuseumFlowController {
|
|
|
return CommonResult.success(result1);
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/Outbound")
|
|
|
- @Operation(summary = "添加出库单")
|
|
|
- public CommonResult<Boolean> createMuseumFlowState(@RequestBody MuseumFlowSaveVO saveVO){
|
|
|
- String sample_id=saveVO.getNumber();
|
|
|
- MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
|
|
|
- if(result == null){
|
|
|
- return CommonResult.error(200,"样品不存在");
|
|
|
- }
|
|
|
- int Save=result.getSave();
|
|
|
- // 0现为已出库,1为未出库或已回库,2为审批中,3为审批通过
|
|
|
- if(Save == 0){
|
|
|
- return CommonResult.error(200,"样品不在库中");
|
|
|
- }
|
|
|
- else if (Save == 2){
|
|
|
- return CommonResult.error(200,"样品正在审批");
|
|
|
- }
|
|
|
- else {
|
|
|
- museumFlowService.createMuseumFlow(saveVO);
|
|
|
- museumFlowService.updateMuseumFlowState(saveVO);
|
|
|
- return CommonResult.success(true);
|
|
|
- }
|
|
|
- }
|
|
|
+// @PostMapping("/outbound")
|
|
|
+// @Operation(summary = "添加出库单")
|
|
|
+// public CommonResult<Boolean> createMuseumFlowOutbound(@RequestBody MuseumFlowSaveVO saveVO){
|
|
|
+// List<String>sample_id=saveVO.getNumber();
|
|
|
+// MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
|
|
|
+// if(result == null){
|
|
|
+// return CommonResult.error(200,"样品不存在");
|
|
|
+// }else if(result != null){
|
|
|
+// int Save=result.getSave();
|
|
|
+// if (Save == 0) {
|
|
|
+// return CommonResult.error(200, "样品不在库中");
|
|
|
+// } else {
|
|
|
+// museumFlowService.createMuseumFlow(saveVO);
|
|
|
+// museumFlowService.updateMuseumFlowStateOutbound2(saveVO);
|
|
|
+// return CommonResult.success(true);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return CommonResult.success(true);
|
|
|
+// }
|
|
|
|
|
|
- @GetMapping("/page")
|
|
|
- @Operation(summary = "获取分页")
|
|
|
- public PageResult<MuseumFlowDO> selectPageS(@Valid MuseumFlowPageVO pageVO){
|
|
|
- return museumFlowService.selectPageS(pageVO);
|
|
|
+ @GetMapping("/pagePerson")
|
|
|
+ @Operation(summary = "获取关于出库员的分页")
|
|
|
+ public PageResult<MuseumFlowDO> selectMuseumFlowOutboundPerson(@Valid MuseumFlowPageVO pageVO){
|
|
|
+ return museumFlowService.selectPageMuseumFlowOutboundPerson(pageVO);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/review")
|
|
|
- @Operation(summary = "新增通过的审批单")
|
|
|
- public CommonResult<Boolean> createMuseumAFlowReview(@RequestBody MuseumFlowSaveVO saveVO) {
|
|
|
- String sample_id = saveVO.getNumber();
|
|
|
+ @Operation(summary = "通过的审批单")
|
|
|
+ public CommonResult<Boolean> createMuseumFlowReview(@RequestBody MuseumFlowReviewVO reviewVO) {
|
|
|
+ String sample_id = reviewVO.getNumber();
|
|
|
+ String number = reviewVO.getNumber();
|
|
|
MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
|
|
|
+ MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(number);
|
|
|
+
|
|
|
+ int Save = result.getSave();
|
|
|
+ int State = event.getState();
|
|
|
+// Save中 0现为未出库或已回库,1为已出库
|
|
|
+// State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
|
|
|
+ //TODO 你这里上面获取了result和event的值再判断他为空,怎么可能为空 ,所以如果为空的话,上面两句就直接报错了
|
|
|
if (result == null) {
|
|
|
return CommonResult.error(200, "样品不存在");
|
|
|
+ } else if (event == null) {
|
|
|
+ return CommonResult.error(200, "样品在出入库的库中不存在");
|
|
|
}
|
|
|
- int Save = result.getSave();
|
|
|
- // 0现为已出库,1为未出库或已回库,2为审批中,3为审批通过,4为审批驳回
|
|
|
- if (Save == 4) {
|
|
|
- return CommonResult.error(200, "样品审批已被驳回");
|
|
|
- }
|
|
|
- else if (Save == 3) {
|
|
|
- return CommonResult.error(200, "样品已审批通过");
|
|
|
- }
|
|
|
- else if (Save == 1) {
|
|
|
+ else if (Save == 0) {
|
|
|
return CommonResult.error(200, "样品并未申请出库");
|
|
|
+ } else if (Save == 1) {
|
|
|
+ if (State == 2) {
|
|
|
+ museumFlowService.createMuseumFlowReview(reviewVO);
|
|
|
+ museumFlowService.updateMuseumFlowStateReview3(reviewVO);
|
|
|
+ return CommonResult.success(true);
|
|
|
+ } else if (State == 3) {
|
|
|
+ return CommonResult.error(200, "样品已审批通过");
|
|
|
+ } else if (State == 4) {
|
|
|
+ return CommonResult.error(200, "样品审批已被驳回");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return CommonResult.error(200, "样品已审批通过并出库");
|
|
|
}
|
|
|
- else if (Save == 2) {
|
|
|
- museumFlowService.createMuseumFlow(saveVO);
|
|
|
- museumFlowService.updateMuseumFlowState3(saveVO);
|
|
|
- return CommonResult.success(true);
|
|
|
- }
|
|
|
- else {
|
|
|
- return CommonResult.error(200,"样品已审批通过并出库");
|
|
|
- }
|
|
|
+ return CommonResult.success(true);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/reject")
|
|
|
- @Operation(summary = "新增拒绝的审批单")
|
|
|
- public CommonResult<Boolean> createMuseumAFlowReject(@RequestBody MuseumFlowSaveVO saveVO) {
|
|
|
- String sample_id = saveVO.getNumber();
|
|
|
+ @Operation(summary = "新增驳回的审批单")
|
|
|
+ public CommonResult<Boolean> createMuseumFlowReject(@RequestBody MuseumFlowReviewVO reviewVO) {
|
|
|
+ String sample_id = reviewVO.getNumber();
|
|
|
+ String number = reviewVO.getNumber();
|
|
|
MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
|
|
|
+ MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(number);
|
|
|
+ int Save = result.getSave();
|
|
|
+ int State = event.getState();
|
|
|
+// Save中 0现为未出库或已回库,1为已出库
|
|
|
+// State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
|
|
|
if (result == null) {
|
|
|
return CommonResult.error(200, "样品不存在");
|
|
|
- }
|
|
|
- int Save = result.getSave();
|
|
|
- // 0现为已出库,1为未出库或已回库,2为审批中,3为审批通过,4为审批驳回
|
|
|
- if (Save == 4) {
|
|
|
- return CommonResult.error(200, "样品审批已被驳回");
|
|
|
- }
|
|
|
- else if (Save == 3) {
|
|
|
- return CommonResult.error(200, "样品已审批通过");
|
|
|
+ } else if (event == null) {
|
|
|
+ return CommonResult.error(200, "样品在出入库的库中不存在");
|
|
|
}
|
|
|
else if (Save == 1) {
|
|
|
- return CommonResult.error(200, "样品并未申请出库");
|
|
|
- }
|
|
|
- else if (Save == 2) {
|
|
|
- museumFlowService.createMuseumFlow(saveVO);
|
|
|
- museumFlowService.updateMuseumFlowState4(saveVO);
|
|
|
- return CommonResult.success(true);
|
|
|
+ return CommonResult.error(200, "样品已出库");
|
|
|
+ } else if (Save == 0) {
|
|
|
+ if (State == 2) {
|
|
|
+ museumFlowService.createMuseumFlowReview(reviewVO);
|
|
|
+ museumFlowService.updateMuseumFlowStateReview4(reviewVO);
|
|
|
+ return CommonResult.success(true);
|
|
|
+ } else if (State == 3) {
|
|
|
+ return CommonResult.error(200, "样品已审批通过");
|
|
|
+ } else if (State == 4) {
|
|
|
+ return CommonResult.error(200, "样品审批已被驳回");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return CommonResult.error(200, "样品已审批通过并出库");
|
|
|
}
|
|
|
- else {
|
|
|
- return CommonResult.error(200,"样品已审批通过并出库");
|
|
|
+ return CommonResult.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/return")
|
|
|
+ @Operation(summary = "新建回库单")
|
|
|
+ public CommonResult<Boolean> createMuseumFlowReturn(@RequestBody MuseumFlowReturnVO returnVO) {
|
|
|
+ String sample_id = returnVO.getNumber();
|
|
|
+ String number = returnVO.getNumber();
|
|
|
+ MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
|
|
|
+ MuseumFlowDO event = museumFlowService.selectMuseumFlowNumber(number);
|
|
|
+ int Save = result.getSave();
|
|
|
+ int State = event.getState();
|
|
|
+// Save中 0现为未出库或已回库,1为已出库
|
|
|
+// State中 0现为未出库或已回库,1为已出库,2为审批中,3为审批通过,4为审批驳回
|
|
|
+ if (result == null) {
|
|
|
+ return CommonResult.error(200, "样品不存在");
|
|
|
+ } else if (event == null) {
|
|
|
+ return CommonResult.error(200, "样品在出入库的库中不存在");
|
|
|
+ }
|
|
|
+ if (Save == 1) {
|
|
|
+ return CommonResult.error(200, "样品已出库");
|
|
|
+ } else if (Save == 0) {
|
|
|
+ if (State == 2) {
|
|
|
+ museumFlowService.createMuseumFlowReturn(returnVO);
|
|
|
+ museumFlowService.updateMuseumFlowSave0(returnVO);
|
|
|
+ return CommonResult.success(true);
|
|
|
+ } else if (State == 3) {
|
|
|
+ return CommonResult.error(200, "样品已审批通过");
|
|
|
+ } else if (State == 4) {
|
|
|
+ return CommonResult.error(200, "样品审批已被驳回");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return CommonResult.error(200, "样品已审批通过并出库");
|
|
|
}
|
|
|
+ return CommonResult.success(true);
|
|
|
}
|
|
|
+
|
|
|
}
|