|
@@ -6,6 +6,7 @@ import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
|
+import com.fjhx.item.entity.product.po.ProductInfo;
|
|
|
import com.fjhx.item.service.product.ProductInfoService;
|
|
|
import com.fjhx.mes.entity.report.dto.ReportLossesDetailsDto;
|
|
|
import com.fjhx.mes.entity.report.dto.ReportLossesDetailsSelectDto;
|
|
@@ -53,8 +54,26 @@ public class ReportLossesDetailsServiceImpl extends ServiceImpl<ReportLossesDeta
|
|
|
wrapper.eq("rld", ReportLossesDetailsVo::getType, dto.getType());
|
|
|
|
|
|
//近n天过滤
|
|
|
- wrapper.ge("DATEDIFF(NOW(),rld.repo_time)", 0);
|
|
|
- wrapper.le("DATEDIFF(NOW(),rld.repo_time)", dto.getPastDay());
|
|
|
+ Integer pastDay = dto.getPastDay();
|
|
|
+ if (ObjectUtil.isNotEmpty(pastDay)) {
|
|
|
+ wrapper.ge("DATEDIFF(NOW(),rld.repo_time)", 0);
|
|
|
+ wrapper.le("DATEDIFF(NOW(),rld.repo_time)", pastDay);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //关键字检索
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getKeyword())) {
|
|
|
+ List<Long> pIds = productInfoService.listObject(ProductInfo::getId, q -> q
|
|
|
+ .like(ProductInfo::getCode, dto.getKeyword())
|
|
|
+ .like(ProductInfo::getName, dto.getKeyword())
|
|
|
+ );
|
|
|
+ wrapper.and(q -> q
|
|
|
+ .in("sjd.product_id", pIds)
|
|
|
+ .or().like("rld.repo_time", dto.getKeyword())
|
|
|
+ .or().like("po.code", dto.getKeyword())
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
wrapper.groupBy("rld.id");
|
|
|
|
|
@@ -70,6 +89,9 @@ public class ReportLossesDetailsServiceImpl extends ServiceImpl<ReportLossesDeta
|
|
|
productInfoService.attributeAssign(records, ReportLossesDetailsVo::getMaterialId, (item, product) -> {
|
|
|
item.setMaterialCode(product.getCustomCode());
|
|
|
item.setMaterialName(product.getName());
|
|
|
+ item.setMaterialLength(product.getLength());
|
|
|
+ item.setMaterialWidth(product.getWidth());
|
|
|
+ item.setMaterialHeight(product.getHeight());
|
|
|
});
|
|
|
|
|
|
return page;
|