|
@@ -4,15 +4,21 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fjhx.common.utils.Assert;
|
|
|
+import com.fjhx.item.entity.product.po.ProductInfo;
|
|
|
import com.fjhx.item.service.product.ProductInfoService;
|
|
|
import com.fjhx.victoriatourist.entity.excess.dto.ExcessGoodsDetailsDto;
|
|
|
import com.fjhx.victoriatourist.entity.excess.dto.ExcessGoodsDetailsSelectDto;
|
|
|
import com.fjhx.victoriatourist.entity.excess.po.ExcessGoodsDetails;
|
|
|
import com.fjhx.victoriatourist.entity.excess.po.ExcessGoodsRegister;
|
|
|
import com.fjhx.victoriatourist.entity.excess.vo.ExcessGoodsDetailsVo;
|
|
|
+import com.fjhx.victoriatourist.entity.logistics.po.LogisticsInfos;
|
|
|
import com.fjhx.victoriatourist.mapper.excess.ExcessGoodsDetailsMapper;
|
|
|
import com.fjhx.victoriatourist.service.excess.ExcessGoodsDetailsService;
|
|
|
import com.fjhx.victoriatourist.service.excess.ExcessGoodsRegisterService;
|
|
|
+import com.fjhx.victoriatourist.service.logistics.LogisticsInfosService;
|
|
|
+import com.fjhx.wms.entity.stock.po.StockWait;
|
|
|
+import com.fjhx.wms.service.stock.StockWaitService;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -35,9 +41,12 @@ public class ExcessGoodsDetailsServiceImpl extends ServiceImpl<ExcessGoodsDetail
|
|
|
|
|
|
@Autowired
|
|
|
private ExcessGoodsRegisterService excessGoodsRegisterService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private ProductInfoService productInfoService;
|
|
|
+ @Autowired
|
|
|
+ private StockWaitService stockWaitService;
|
|
|
+ @Autowired
|
|
|
+ private LogisticsInfosService logisticsInfosService;
|
|
|
|
|
|
private IWrapper<ExcessGoodsDetails> getWrapper(ExcessGoodsDetailsSelectDto dto) {
|
|
|
IWrapper<ExcessGoodsDetails> wrapper = getWrapper();
|
|
@@ -49,6 +58,9 @@ public class ExcessGoodsDetailsServiceImpl extends ServiceImpl<ExcessGoodsDetail
|
|
|
@Override
|
|
|
public List<ExcessGoodsDetailsVo> getList(ExcessGoodsDetailsSelectDto dto) {
|
|
|
IWrapper<ExcessGoodsDetails> wrapper = getWrapper(dto);
|
|
|
+ //过滤未提交的数据
|
|
|
+ wrapper.eq("egd", ExcessGoodsDetails::getIsSubmit, 0);
|
|
|
+
|
|
|
List<ExcessGoodsDetailsVo> list = this.baseMapper.getList(wrapper);
|
|
|
setInfo(list);
|
|
|
return list;
|
|
@@ -57,11 +69,33 @@ public class ExcessGoodsDetailsServiceImpl extends ServiceImpl<ExcessGoodsDetail
|
|
|
@Override
|
|
|
public Page<ExcessGoodsDetailsVo> getPage(ExcessGoodsDetailsSelectDto dto) {
|
|
|
IWrapper<ExcessGoodsDetails> wrapper = getWrapper(dto);
|
|
|
+
|
|
|
+ //过滤已提交的数据
|
|
|
+ wrapper.eq("egd", ExcessGoodsDetails::getIsSubmit, 1);
|
|
|
+
|
|
|
+ //处理结果过滤
|
|
|
+ wrapper.eq("egd", ExcessGoodsDetails::getProcessingMethod, dto.getProcessingMethod());
|
|
|
+
|
|
|
+ //关键字检索
|
|
|
+ String keyword = dto.getKeyword();
|
|
|
+ if (ObjectUtil.isNotEmpty(keyword)) {
|
|
|
+ List<Long> productIds = productInfoService.listObject(ProductInfo::getId,
|
|
|
+ q -> q.like(ProductInfo::getCustomCode, keyword).or().like(ProductInfo::getName, keyword));
|
|
|
+ wrapper.and(q -> q
|
|
|
+ .like("sw.business_code", keyword)
|
|
|
+ .or().like("lis.logistics_company_code", keyword)
|
|
|
+ .or().like("lis.`code`", keyword)
|
|
|
+ .or().like("egd", ExcessGoodsDetails::getQuantity, keyword)
|
|
|
+ .or().in("egd", ExcessGoodsDetails::getProductId, productIds)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
Page<ExcessGoodsDetailsVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
List<ExcessGoodsDetailsVo> records = page.getRecords();
|
|
|
if (ObjectUtil.isEmpty(records)) {
|
|
|
return page;
|
|
|
}
|
|
|
+ setInfo(records);
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -97,8 +131,16 @@ public class ExcessGoodsDetailsServiceImpl extends ServiceImpl<ExcessGoodsDetail
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void add(ExcessGoodsDetailsDto excessGoodsDetailsDto) {
|
|
|
- this.save(excessGoodsDetailsDto);
|
|
|
+ public void add(ExcessGoodsDetailsDto dto) {
|
|
|
+ Long stockWaitId = dto.getStockWaitId();
|
|
|
+ Assert.notEmpty(stockWaitId, "待入库id不能为空");
|
|
|
+ StockWait stockWait = stockWaitService.getById(stockWaitId);
|
|
|
+ Assert.notEmpty(stockWait, "查询不到待入库信息");
|
|
|
+ LogisticsInfos one = logisticsInfosService.getOne(q -> q.eq(LogisticsInfos::getBusinessId, stockWait.getDeliverGoodsId()));
|
|
|
+ if (ObjectUtil.isNotEmpty(one)) {
|
|
|
+ dto.setLogisticsInfosId(one.getId());
|
|
|
+ }
|
|
|
+ this.save(dto);
|
|
|
}
|
|
|
|
|
|
@Override
|