|
@@ -4,15 +4,19 @@ 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.*;
|
|
|
+import cn.iocoder.yudao.module.museum.controller.admin.museuminfo.vo.MuseumInfoPageReqVO;
|
|
|
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.dal.mysql.museumflow.MuseumFlowMapper;
|
|
|
import cn.iocoder.yudao.module.museum.service.museumflow.MuseumFlowService;
|
|
|
+import cn.iocoder.yudao.module.museum.service.museuminfo.MuseumInfoService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Tag(name = "博物馆-出回库管理")
|
|
@@ -22,6 +26,7 @@ public class MuseumFlowController {
|
|
|
|
|
|
@Resource
|
|
|
private MuseumFlowService museumFlowService;
|
|
|
+ private MuseumInfoService museumInfoService;
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "新增表单")
|
|
@@ -51,31 +56,46 @@ public class MuseumFlowController {
|
|
|
return CommonResult.success(result1);
|
|
|
}
|
|
|
|
|
|
-// @PostMapping("/outbound")
|
|
|
-// @Operation(summary = "添加出库单")
|
|
|
-// public CommonResult<Boolean> createMuseumFlowOutbound(@RequestBody MuseumFlowSaveVO saveVO){
|
|
|
-// List<String>sample_ids=saveVO.getNumber();
|
|
|
-// for (String sample_id :sample_ids){
|
|
|
-// MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
|
|
|
-// if (result==null){
|
|
|
-// return CommonResult.error(200,sample_id+"标本不存在");
|
|
|
-// }
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// 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);
|
|
|
-// }
|
|
|
+ @PostMapping("/outbound")
|
|
|
+ @Operation(summary = "添加出库单")
|
|
|
+ public CommonResult<Boolean> createMuseumFlowOutbound(@RequestBody MuseumFlowSaveVO saveVO) {
|
|
|
+ List<String> sample_ids = saveVO.getNumber();
|
|
|
+ List<String> errorList = new ArrayList<>();
|
|
|
+ List<String> sample_names = new ArrayList<>();
|
|
|
+ for (String sample_id : sample_ids) {
|
|
|
+ MuseumInfoDO result = museumFlowService.selectMuseumFlowSampleId(sample_id);
|
|
|
+ if (result == null) {
|
|
|
+ errorList.add(sample_id+"标本不存在");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ int save = result.getSave();
|
|
|
+ String name = result.getChineseName();
|
|
|
+ if (save == 0) {
|
|
|
+ errorList.add(sample_id+"标本不在库中");
|
|
|
+ }else {
|
|
|
+ sample_names.add(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (errorList.isEmpty()) {
|
|
|
+ saveVO.setSampleName(sample_names);//设置标本名称
|
|
|
+ museumFlowService.createMuseumFlow(saveVO);//创建表单
|
|
|
+ museumFlowService.updateMuseumFlowStateOutbound2(saveVO);//更改标本状态为出库
|
|
|
+
|
|
|
+
|
|
|
+// museumFlowService.selectPageS(respVO);
|
|
|
+ return CommonResult.success(true);
|
|
|
+ }else {
|
|
|
+ System.out.println(errorList);
|
|
|
+ return CommonResult.error(200, "标本存在错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectPageS")
|
|
|
+ @Operation(summary = "获取关于标本信息的分页")
|
|
|
+ public PageResult<MuseumInfoDO> selectPageS(@Valid MuseumInfoPageReqVO pageVO){
|
|
|
+ return museumInfoService.getMuseumInfoPage(pageVO);
|
|
|
+ }
|
|
|
|
|
|
@GetMapping("/pagePerson")
|
|
|
@Operation(summary = "获取关于出库员的分页")
|