consum-base/src/main/java/com/consum/base/service/impl/LWhFormScrappedServiceImpl.java
@@ -1,6 +1,7 @@
package com.consum.base.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -49,6 +50,7 @@
import com.consum.model.po.SDictData;
import com.iplatform.model.po.S_user_core;
import com.walker.db.page.GenericPager;
import com.walker.infrastructure.utils.DateUtils;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.jdbc.service.BaseServiceImpl;
@@ -125,6 +127,7 @@
        lWhFormScrapped.setOperatorName(sysInfo.getUserName());
        lWhFormScrapped.setDealTime(param.getDealTime());
        lWhFormScrapped.setStates(0);
        lWhFormScrapped.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis()));
        lWhFormScrapped.setUploadFiles(param.getUploadFiles());
        // 根据部门id查询部门
        FinSysTenantDepartment department = this.departmentService.getById(sysInfo.getSysDeptId());
@@ -175,8 +178,9 @@
                LWhFormScrappedGoods scrappedGoods = new LWhFormScrappedGoods();
                scrappedGoods.setId(IdUtil.generateId());
                // 根据物品型号查询物品库存
                List<Long> warehouseIds = new ArrayList<>(Arrays.asList(warehouseId));
                int goodsNum =
                    lWhGoodsService.queryGoodsModelNum(0, warehouseId, scrappedGoods.getBaseGoodsModelsId(), 1, null);
                    lWhGoodsService.queryGoodsModelNum(0, warehouseIds, scrappedGoods.getBaseGoodsModelsId(), 1, null);
                if (params.getCounts() > goodsNum) {
                    log.error("报废数量大于库存数量");
                    return 0;
@@ -200,7 +204,7 @@
                scrappedGoodsList.add(scrappedGoods);
            }
            int flag2 = this.scrappedGoodsService.insertBatch(scrappedGoodsList);
            if (flag2 != scrappedGoodsList.size()) {
            if (flag2 == 0) {
                log.error("新增报废单物品记录 失败");
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                return 0;