|
@@ -1,15 +1,20 @@
|
|
|
package com.fjhx.mes.service.production.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
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.item.service.product.ProductInfoService;
|
|
|
import com.fjhx.mes.entity.production.dto.ProductionSchedulingDto;
|
|
|
import com.fjhx.mes.entity.production.dto.ProductionSchedulingSelectDto;
|
|
|
+import com.fjhx.mes.entity.production.po.ProductionOrder;
|
|
|
import com.fjhx.mes.entity.production.po.ProductionScheduling;
|
|
|
import com.fjhx.mes.entity.production.vo.ProductionSchedulingVo;
|
|
|
import com.fjhx.mes.mapper.production.ProductionSchedulingMapper;
|
|
|
import com.fjhx.mes.service.production.ProductionSchedulingService;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -21,12 +26,47 @@ import java.util.stream.Collectors;
|
|
|
* 生产排程 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
- * @author
|
|
|
* @since 2024-02-03
|
|
|
*/
|
|
|
@Service
|
|
|
public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSchedulingMapper, ProductionScheduling> implements ProductionSchedulingService {
|
|
|
|
|
|
+ private final ProductInfoService productInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public ProductionSchedulingServiceImpl(ProductInfoService productInfoService) {
|
|
|
+ this.productInfoService = productInfoService;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<ProductionSchedulingVo> getPage(ProductionSchedulingSelectDto dto) {
|
|
|
+ IWrapper<ProductionScheduling> wrapper = getWrapper();
|
|
|
+ //只显示投产的数据
|
|
|
+ wrapper.isNotNull("po.produce_time");
|
|
|
+ //工序id过滤
|
|
|
+ wrapper.eq(ProductionScheduling::getProcessesId, dto.getProcessesId());
|
|
|
+
|
|
|
+ //权限过滤:生产排程-1
|
|
|
+ wrapper.in("po", ProductionOrder::getCompanyId, SecurityUtils.getCompanyIds());
|
|
|
+ wrapper.eq("po", ProductionOrder::getCompanyId, dto.getCompanyId());
|
|
|
+
|
|
|
+ Page<ProductionSchedulingVo> page = baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ List<ProductionSchedulingVo> records = page.getRecords();
|
|
|
+ if (ObjectUtil.isEmpty(records)) {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+ //赋值产品信息
|
|
|
+ productInfoService.attributeAssign(records, ProductionSchedulingVo::getProductId, (item, productInfo) -> {
|
|
|
+ item.setProductName(productInfo.getName());
|
|
|
+ item.setProductCode(productInfo.getCustomCode());
|
|
|
+ item.setProductLength(productInfo.getLength());
|
|
|
+ item.setProductWidth(productInfo.getWidth());
|
|
|
+ item.setProductHeight(productInfo.getHeight());
|
|
|
+ item.setProductColor(productInfo.getColor());
|
|
|
+ });
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, List<ProductionSchedulingVo>> listMap(ProductionSchedulingSelectDto dto) {
|
|
|
IWrapper<ProductionScheduling> wrapper = getWrapper();
|