hyingbo
15 小时以前 9ac81ccf7262ce6d73d6e8970439482d8439282c
lxzn-module-tms/src/main/java/org/jeecg/modules/tms/controller/ToolsStocktakingBoundController.java
@@ -1,5 +1,6 @@
package org.jeecg.modules.tms.controller;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -15,9 +16,7 @@
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
import org.jeecg.modules.tms.entity.BaseTools;
import org.jeecg.modules.tms.entity.ToolsStocktakingBound;
import org.jeecg.modules.tms.entity.ToolsStocktakingBoundDetail;
import org.jeecg.modules.tms.entity.*;
import org.jeecg.modules.tms.entity.dto.LossBoundFlowDto;
import org.jeecg.modules.tms.entity.dto.StocktakingBoundFlowDto;
import org.jeecg.modules.tms.entity.vo.ToolsStocktakingVo;
@@ -37,6 +36,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -171,27 +171,42 @@
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    @Transactional(rollbackFor = {Exception.class})
    public Result<String> edit(@RequestBody ToolsStocktakingBound toolsStocktakingBound) {
        if (toolsStocktakingBound == null || StringUtils.isBlank(toolsStocktakingBound.getId())) {
            return Result.error("参数错误");
        }
        toolsStocktakingBoundDetailService.remove(new LambdaQueryWrapper<ToolsStocktakingBoundDetail>()
        toolsStocktakingBoundService.updateById(toolsStocktakingBound);
        // 删除申请单明细数据
                toolsStocktakingBoundDetailService.remove(new LambdaQueryWrapper<ToolsStocktakingBoundDetail>()
                .eq(ToolsStocktakingBoundDetail::getStocktakingBoundId, toolsStocktakingBound.getId()));
        ToolsStocktakingBound stocktakingBound = new ToolsStocktakingBound();
        BeanUtils.copyProperties(stocktakingBound, toolsStocktakingBound);
        toolsStocktakingBoundMapper.updateById(stocktakingBound);
        List<ToolsStocktakingBoundDetail> detailList = toolsStocktakingBound.getToolsStocktakingBoundDetailList();
        if (CollectionUtils.isEmpty(detailList)) {
            return Result.error("明细不能为空");
        }
        for (ToolsStocktakingBoundDetail item : detailList) {
            item.setStocktakingBoundId(toolsStocktakingBound.getId());
            item.setToolId(item.getToolId());
            item.setToolCode(item.getToolCode());
            item.setRemark(item.getRemark());
            item.setStocktakingDate(item.getStocktakingDate());
            item.setBookQuantity(item.getBookQuantity());
            item.setAvailableQuantity(item.getAvailableQuantity());
            item.setPracticalQuantity(item.getPracticalQuantity());
            item.setSurplusDeficit(item.getSurplusDeficit());
            item.setDifferenceValue(item.getDifferenceValue());
            item.setParamaTableName(item.getParamaTableName());
            item.setForeignLanguageName(item.getForeignLanguageName());
            item.setChineseName(item.getChineseName());
            item.setSupplierId(item.getSupplierId());
            item.setStorageLocation(item.getStorageLocation());
            item.setToolMaterial(item.getToolMaterial());
            item.setToolModel(item.getToolModel());
            item.setPositionCode(item.getPositionCode());
            item.setClassifyId(item.getClassifyId());
            item.setApplicationType(item.getApplicationType());
            toolsStocktakingBoundDetailService.saveOrUpdate(item);
        }
        toolsStocktakingBoundDetailService.saveOrUpdateBatch(detailList);
        return Result.OK("操作成功!");
        detailList.forEach(item -> item.setStocktakingBoundId(stocktakingBound.getId()));
        toolsStocktakingBoundDetailService.saveBatch(detailList);
        return Result.OK("编辑成功");
    }
@@ -283,4 +298,23 @@
        return Result.OK("文件导入失败!");
    }
    /**
     * 工具台账-盘点子页面列表查询
     *
     * @param toolsStocktakingBound
     * @param pageNo
     * @param pageSize
     * @param query
     * @return
     */
    @ApiOperation(value="工具台账-盘点子页面列表查询", notes="工具台账-盘点子页面列表查询")
    @GetMapping(value = "/toolsStocktakingList")
    public Result<?> toolsStocktakingList(ToolsStocktakingBound toolsStocktakingBound,
                                        @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                        @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                        @RequestParam Map<String, String> query) {
        IPage<Map<String, Object>> pageList = toolsStocktakingBoundDetailService.toolsStocktakingList(pageNo,pageSize, query);
        return Result.OK(pageList);
    }
}