|
@@ -10,15 +10,18 @@ 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.ProductionOrderDetail;
|
|
|
import com.fjhx.mes.entity.production.po.ProductionScheduling;
|
|
|
import com.fjhx.mes.entity.production.vo.ProductionOrderDetailVo;
|
|
|
import com.fjhx.mes.entity.production.vo.ProductionSchedulingVo;
|
|
|
import com.fjhx.mes.mapper.production.ProduceOrderDetailMapper;
|
|
|
import com.fjhx.mes.mapper.production.ProductionSchedulingMapper;
|
|
|
import com.fjhx.mes.service.production.ProductionSchedulingService;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
+import com.ruoyi.system.service.ISysUserService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -40,16 +43,48 @@ public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSched
|
|
|
|
|
|
private final ProductInfoService productInfoService;
|
|
|
private final ProduceOrderDetailMapper produceOrderDetailMapper;
|
|
|
+ private final ISysUserService sysUserService;
|
|
|
|
|
|
@Autowired
|
|
|
- public ProductionSchedulingServiceImpl(ProductInfoService productInfoService, ProduceOrderDetailMapper produceOrderDetailMapper) {
|
|
|
+ public ProductionSchedulingServiceImpl(ProductInfoService productInfoService, ProduceOrderDetailMapper produceOrderDetailMapper, ISysUserService sysUserService) {
|
|
|
this.productInfoService = productInfoService;
|
|
|
this.produceOrderDetailMapper = produceOrderDetailMapper;
|
|
|
+ this.sysUserService = sysUserService;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Page<ProductionSchedulingVo> getPage(ProductionSchedulingSelectDto dto) {
|
|
|
IWrapper<ProductionScheduling> wrapper = getWrapper();
|
|
|
+
|
|
|
+ //===============================================================================================
|
|
|
+ //业务公司过滤
|
|
|
+ wrapper.eq("c.of_company_id", dto.getContractCompanyId());
|
|
|
+ //生产公司
|
|
|
+ wrapper.eq("po", ProductionOrder::getCompanyId, dto.getCompanyId());
|
|
|
+ //生产状态
|
|
|
+ String produceStatus = dto.getProduceStatus();
|
|
|
+ if (ObjectUtil.isNotEmpty(produceStatus)) {
|
|
|
+ wrapper.in("pod", ProductionOrderDetail::getProduceStatus, produceStatus.split(","));
|
|
|
+ }
|
|
|
+ //是否逾期过滤
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getIsOverdue())) {
|
|
|
+ wrapper.eq("IF(IFNULL(po.finish_time,NOW())>po.delivery_period,1,0)", dto.getIsOverdue());
|
|
|
+ }
|
|
|
+ //交期-时间范围过滤
|
|
|
+ wrapper.ge("po", ProductionOrder::getDeliveryPeriod, dto.getStaDeliveryPeriod());
|
|
|
+ wrapper.le("po", ProductionOrder::getDeliveryPeriod, dto.getEndDeliveryPeriod());
|
|
|
+
|
|
|
+ //关键字
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getKeyword())) {
|
|
|
+ List<SysUser> list = sysUserService.list(IWrapper.<SysUser>getWrapper().like(SysUser::getNickName, dto.getKeyword()));
|
|
|
+ List<Long> uIds = list.stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
|
+ wrapper.and(q -> q
|
|
|
+ .like("po.code", dto.getKeyword())
|
|
|
+ .or().in("c.create_user", uIds)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //======================================================================================================
|
|
|
+
|
|
|
//只显示投产的数据
|
|
|
wrapper.isNotNull("po.produce_time");
|
|
|
//工序id过滤
|