|
@@ -9,21 +9,21 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
import java.net.URLDecoder;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
+
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.kc.entity.*;
|
|
import org.jeecg.modules.kc.entity.*;
|
|
|
import org.jeecg.modules.kc.enums.StorageEnum;
|
|
import org.jeecg.modules.kc.enums.StorageEnum;
|
|
|
-import org.jeecg.modules.kc.service.IKcDepositoryInGoodsService;
|
|
|
|
|
-import org.jeecg.modules.kc.service.IKcGoodsService;
|
|
|
|
|
-import org.jeecg.modules.kc.service.IKcStockDetailService;
|
|
|
|
|
|
|
+import org.jeecg.modules.kc.service.*;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
-import org.jeecg.modules.kc.service.IKcSupplierInGoodsService;
|
|
|
|
|
import org.jeecg.modules.rooms.entity.CesGoodsUnit;
|
|
import org.jeecg.modules.rooms.entity.CesGoodsUnit;
|
|
|
import org.jeecg.modules.rooms.service.CesGoodsUnitServiceImpl;
|
|
import org.jeecg.modules.rooms.service.CesGoodsUnitServiceImpl;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
@@ -62,6 +62,10 @@ public class KcStockDetailController extends JeecgController<KcStockDetail, IKcS
|
|
|
private CesGoodsUnitServiceImpl cesGoodsUnitService;
|
|
private CesGoodsUnitServiceImpl cesGoodsUnitService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IKcSupplierInGoodsService kcSupplierInGoodsService;
|
|
private IKcSupplierInGoodsService kcSupplierInGoodsService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IKcStockService kcStockService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IKcDepositoryInGoodsService kcDepositoryInGoodsService;
|
|
|
/**
|
|
/**
|
|
|
* 分页列表查询
|
|
* 分页列表查询
|
|
|
*
|
|
*
|
|
@@ -81,20 +85,43 @@ public class KcStockDetailController extends JeecgController<KcStockDetail, IKcS
|
|
|
QueryWrapper<KcStockDetail> queryWrapper = QueryGenerator.initQueryWrapper(kcStockDetail, req.getParameterMap());
|
|
QueryWrapper<KcStockDetail> queryWrapper = QueryGenerator.initQueryWrapper(kcStockDetail, req.getParameterMap());
|
|
|
Page<KcStockDetail> page = new Page<KcStockDetail>(pageNo, pageSize);
|
|
Page<KcStockDetail> page = new Page<KcStockDetail>(pageNo, pageSize);
|
|
|
IPage<KcStockDetail> pageList = kcStockDetailService.page(page, queryWrapper);
|
|
IPage<KcStockDetail> pageList = kcStockDetailService.page(page, queryWrapper);
|
|
|
- pageList.getRecords().forEach(item -> {
|
|
|
|
|
- KcSupplierInGoods kcSupplierInGoods = kcSupplierInGoodsService.getById(item.getSupplierInGoodsId());
|
|
|
|
|
- if (kcSupplierInGoods != null) {
|
|
|
|
|
- KcGoods kcGoods = kcGoodsService.getById(kcSupplierInGoods.getGoodsId());
|
|
|
|
|
- if (kcGoods != null) {
|
|
|
|
|
- item.setSpec(kcGoods.getSpec());
|
|
|
|
|
- item.setName(kcGoods.getName());
|
|
|
|
|
- CesGoodsUnit cesGoodsUnit = cesGoodsUnitService.getById(kcGoods.getGoodUnit());
|
|
|
|
|
- if (cesGoodsUnit != null) {
|
|
|
|
|
- item.setGoodUnit(cesGoodsUnit.getName());
|
|
|
|
|
|
|
+ KcStock kcStock = null;
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(kcStockDetail.getStockId())) {
|
|
|
|
|
+ LambdaQueryWrapper<KcStock> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ lambdaQueryWrapper.eq(KcStock::getCode, kcStockDetail.getStockId());
|
|
|
|
|
+ kcStock = kcStockService.getOne(lambdaQueryWrapper);
|
|
|
|
|
+ }
|
|
|
|
|
+ for (KcStockDetail record : pageList.getRecords()) {
|
|
|
|
|
+ if (kcStock != null) {
|
|
|
|
|
+ if (kcStock.getType().equals(1)) {
|
|
|
|
|
+ KcDepositoryInGoods kcDepositoryInGoods = kcDepositoryInGoodsService.getById(record.getSupplierInGoodsId());
|
|
|
|
|
+ if (kcDepositoryInGoods != null) {
|
|
|
|
|
+ KcGoods kcGoods = kcGoodsService.getById(kcDepositoryInGoods.getGoodsId());
|
|
|
|
|
+ if (kcGoods != null) {
|
|
|
|
|
+ record.setSpec(kcGoods.getSpec());
|
|
|
|
|
+ record.setName(kcGoods.getName());
|
|
|
|
|
+ CesGoodsUnit cesGoodsUnit = cesGoodsUnitService.getById(kcGoods.getGoodUnit());
|
|
|
|
|
+ if (cesGoodsUnit != null) {
|
|
|
|
|
+ record.setGoodUnit(cesGoodsUnit.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ KcSupplierInGoods kcSupplierInGoods = kcSupplierInGoodsService.getById(record.getSupplierInGoodsId());
|
|
|
|
|
+ if (kcSupplierInGoods != null) {
|
|
|
|
|
+ KcGoods kcGoods = kcGoodsService.getById(kcSupplierInGoods.getGoodsId());
|
|
|
|
|
+ if (kcGoods != null) {
|
|
|
|
|
+ record.setSpec(kcGoods.getSpec());
|
|
|
|
|
+ record.setName(kcGoods.getName());
|
|
|
|
|
+ CesGoodsUnit cesGoodsUnit = cesGoodsUnitService.getById(kcGoods.getGoodUnit());
|
|
|
|
|
+ if (cesGoodsUnit != null) {
|
|
|
|
|
+ record.setGoodUnit(cesGoodsUnit.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ }
|
|
|
return Result.OK(pageList);
|
|
return Result.OK(pageList);
|
|
|
}
|
|
}
|
|
|
|
|
|