石广澎
2023-11-29 24fc98301c0b38a76b7d5aa704fe79a2e385e584
consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java
@@ -1,6 +1,7 @@
package com.consum.base.controller;
import com.consum.base.BaseController;
import com.consum.base.core.utils.CommonUtil;
import com.consum.base.core.utils.PageUtil;
import com.consum.base.pojo.query.LWhFormInventoryQry;
import com.consum.base.pojo.request.FormInventoryParam;
@@ -9,7 +10,6 @@
import com.consum.base.pojo.response.FormInventoryGoodsVO;
import com.consum.base.pojo.response.FormInventoryVO;
import com.consum.base.service.FinSysTenantUserServiceImpl;
import com.consum.base.service.LWhFormInventoryCoreService;
import com.consum.base.service.LWhFormInventoryServiceImpl;
import com.consum.model.po.FinSysTenantUser;
import com.consum.model.po.LWhFormInventory;
@@ -28,7 +28,6 @@
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -46,8 +45,6 @@
    private LWhFormInventoryServiceImpl lWhFormInventoryService;
    @Autowired
    private FinSysTenantUserServiceImpl finSysTenantUserService;
    @Autowired
    private LWhFormInventoryCoreService lWhFormInventoryCoreService;
    /**
@@ -60,7 +57,13 @@
        @ApiImplicitParam(name = "param", value = "盘点单信息", dataType = "FormInventoryParam")
    })
    @PostMapping("/add")
    public ResponseValue add(@RequestBody FormInventoryParam param) {
    public ResponseValue add() {
        FormInventoryParam param = CommonUtil.getObjFromReqBody(FormInventoryParam.class);
        FormInventoryParam formInventoryParam = new FormInventoryParam();
        CommonUtil.copyProperties(param, formInventoryParam);
        param = formInventoryParam;
        FinSysTenantUser sysInfo = this.getSysInfo();
        if (sysInfo == null) {
            return ResponseValue.error("登录用户信息不存在");
@@ -90,7 +93,12 @@
        @ApiImplicitParam(name = "param", value = "盘点条件", dataType = "LWhFormInventoryParam", required = true, paramType = "query")
    })
    @GetMapping("/list")
    public ResponseValue queryList(LWhFormInventoryQry param) {
    public ResponseValue queryList() {
        LWhFormInventoryQry param = CommonUtil.getObjFromReq(LWhFormInventoryQry.class);
        LWhFormInventoryQry param2 = new LWhFormInventoryQry();
        CommonUtil.copyProperties(param, param2);
        param = param2;
        FinSysTenantUser sysInfo = this.getSysInfo();
        if (sysInfo == null) {
            return ResponseValue.error("登录用户信息不存在");
@@ -129,7 +137,12 @@
        @ApiImplicitParam(name = "param", value = "盘点单信息", dataType = "FormInventoryParam")
    })
    @PostMapping("/edit")
    public ResponseValue edit(@RequestBody FormInventoryParam param) {
    public ResponseValue edit() {
        FormInventoryParam param = CommonUtil.getObjFromReqBody(FormInventoryParam.class);
        FormInventoryParam formInventoryParam = new FormInventoryParam();
        CommonUtil.copyProperties(param, formInventoryParam);
        param = formInventoryParam;
        LWhFormInventory lWhFormInventory = lWhFormInventoryService.get(new LWhFormInventory(param.getId()));
        if (lWhFormInventory == null) {
            return ResponseValue.error("编辑失败!");
@@ -141,8 +154,18 @@
        if (num == 0) {
            return ResponseValue.error("编辑失败!");
        }
        ResponseValue add = this.add(param);
        if (add.getCode() == ResponseValue.CODE_SUCCESS) {
        //根据盘点人id查询盘点人
        FinSysTenantUser finSysTenantUser = new FinSysTenantUser();
        finSysTenantUser.setId(param.getOperatorUserId());
        FinSysTenantUser operatorUser = finSysTenantUserService.get(finSysTenantUser);
        //根据监盘人id查询监盘人
        FinSysTenantUser monitorUserInfo = new FinSysTenantUser();
        monitorUserInfo.setId(param.getMonitorUserId());
        FinSysTenantUser monitorUser = finSysTenantUserService.get(monitorUserInfo);
        int result = this.lWhFormInventoryService.add(param, this.getSysInfo(), operatorUser, monitorUser);
        if (result > 0) {
            return ResponseValue.success();
        }
@@ -188,12 +211,17 @@
        @ApiImplicitParam(name = "param", value = "盘点单信息", dataType = "LWhFormInventoryDto")
    })
    @PostMapping("/temporary/storage")
    public ResponseValue temporaryStorage(@RequestBody LWhFormInventoryParam dto) {
        if (dto == null) {
    public ResponseValue updateTemporaryStorage() {
        LWhFormInventoryParam param = CommonUtil.getObjFromReqBody(LWhFormInventoryParam.class);
        LWhFormInventoryParam formInventoryParam = new LWhFormInventoryParam();
        CommonUtil.copyProperties(param, formInventoryParam);
        param = formInventoryParam;
        if (param == null) {
            return ResponseValue.error("参数错误");
        }
        int num = this.lWhFormInventoryService.updateInventoryInfo(dto, 1);
        int num = this.lWhFormInventoryService.updateInventoryInfo(param, 1, null, null);
        return num > 0 ? ResponseValue.success(1) : ResponseValue.error("暂存失败!");
    }
@@ -208,18 +236,20 @@
        @ApiImplicitParam(name = "param", value = "盘点单信息", dataType = "LWhFormInventoryDto")
    })
    @PostMapping("/finish")
    public ResponseValue finishPd(@RequestBody LWhFormInventoryParam dto) {
        if (dto == null) {
    public ResponseValue updateFinishPd() {
        LWhFormInventoryParam param = CommonUtil.getObjFromReqBody(LWhFormInventoryParam.class);
        LWhFormInventoryParam formInventoryParam = new LWhFormInventoryParam();
        CommonUtil.copyProperties(param, formInventoryParam);
        param = formInventoryParam;
        if (param == null) {
            return ResponseValue.error("参数错误");
        }
        int num = this.lWhFormInventoryService.updateInventoryInfo(dto, 2);
        S_user_core currentUser = this.getCurrentUser();
        FinSysTenantUser sysInfo = this.getSysInfo();
        int num = this.lWhFormInventoryService.updateInventoryInfo(param, 2, currentUser, sysInfo);
        String inOutFormByInventoryId = lWhFormInventoryCoreService.createInOutFormByInventoryId(dto.getId(), currentUser, sysInfo);
        return num > 0 ? ResponseValue.success(1) : ResponseValue.error(inOutFormByInventoryId);
        return num > 0 ? ResponseValue.success(1) : ResponseValue.error("盘点失败!");
    }
    /**
@@ -232,7 +262,12 @@
        @ApiImplicitParam(name = "param", value = "盘点条件", dataType = "LWhFormInventoryParam", paramType = "query")
    })
    @GetMapping("/list/PdDetail")
    public ResponseValue queryPdDetailList(LWhFormInventoryQry param) {
    public ResponseValue queryPdDetailList() {
        LWhFormInventoryQry param = CommonUtil.getObjFromReq(LWhFormInventoryQry.class);
        LWhFormInventoryQry param2 = new LWhFormInventoryQry();
        CommonUtil.copyProperties(param, param2);
        param = param2;
        FinSysTenantUser sysInfo = this.getSysInfo();
        if (sysInfo == null) {
            return ResponseValue.error("登录用户信息不存在");