|
@@ -1,7 +1,9 @@
|
|
|
package com.fjhx.mes.service.production.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.common.utils.Assert;
|
|
@@ -15,6 +17,7 @@ import com.fjhx.mes.entity.production.po.ProductionOrderDetail;
|
|
|
import com.fjhx.mes.entity.production.po.ProductionScheduling;
|
|
|
import com.fjhx.mes.entity.production.po.ProductionTaskProgress;
|
|
|
import com.fjhx.mes.entity.production.vo.ProductionOrderDetailVo;
|
|
|
+import com.fjhx.mes.entity.production.vo.ProductionSchedulingVo;
|
|
|
import com.fjhx.mes.entity.production.vo.ProductionTaskProgressVo;
|
|
|
import com.fjhx.mes.mapper.production.ProduceOrderDetailMapper;
|
|
|
import com.fjhx.mes.mapper.production.ProductionTaskProgressMapper;
|
|
@@ -70,6 +73,13 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
|
|
|
public Page<ProductionOrderDetailVo> getPage(ProduceOrderDetailSelectDto dto) {
|
|
|
IWrapper<ProductionOrderDetail> wrapper = getPageCommWrapper(dto);
|
|
|
|
|
|
+ //是否排程过滤
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getIsScheduling())) {
|
|
|
+ wrapper.having("if(count( ps.id )>0,1,0)={0}", dto.getIsScheduling());
|
|
|
+ }
|
|
|
+
|
|
|
+ wrapper.groupBy("pod.id");
|
|
|
+
|
|
|
Page<ProductionOrderDetailVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
|
|
|
return commPage(page);
|
|
@@ -97,7 +107,10 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
|
|
|
|
|
|
|
|
|
//生产状态
|
|
|
- wrapper.eq("pod", ProductionOrderDetail::getProduceStatus, dto.getProduceStatus());
|
|
|
+ String produceStatus = dto.getProduceStatus();
|
|
|
+ if (ObjectUtil.isNotEmpty(produceStatus)) {
|
|
|
+ wrapper.in("pod", ProductionOrderDetail::getProduceStatus, produceStatus.split(","));
|
|
|
+ }
|
|
|
//交期-时间范围过滤
|
|
|
wrapper.ge("po", ProductionOrder::getDeliveryPeriod, dto.getStaDeliveryPeriod());
|
|
|
wrapper.le("po", ProductionOrder::getDeliveryPeriod, dto.getEndDeliveryPeriod());
|
|
@@ -134,6 +147,7 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
|
|
|
if (ObjectUtil.isNotEmpty(dto.getContractType())) {
|
|
|
wrapper.eq("c.contract_type", dto.getContractType());
|
|
|
}
|
|
|
+
|
|
|
return wrapper;
|
|
|
}
|
|
|
|
|
@@ -347,4 +361,28 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public JSONObject taskCount(ProduceOrderDetailSelectDto dto) {
|
|
|
+ //完成任务查询
|
|
|
+ ProduceOrderDetailSelectDto completedCountDto = BeanUtil.copyProperties(dto, ProduceOrderDetailSelectDto.class);
|
|
|
+ completedCountDto.setProduceStatus("2,5,10");
|
|
|
+ //在手任务查询
|
|
|
+ ProduceOrderDetailSelectDto onHandCountDto = BeanUtil.copyProperties(dto, ProduceOrderDetailSelectDto.class);
|
|
|
+ onHandCountDto.setIsScheduling(0);
|
|
|
+
|
|
|
+ //单个工序查询
|
|
|
+ String dayDate = DateUtil.format(dto.getSchedulingDate(), "yyyy-MM-dd");
|
|
|
+ List<ProductionSchedulingVo> productionSchedulingList = baseMapper.getProcessesSchedulingByDay(dayDate);
|
|
|
+
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("onHandCount", getPage(onHandCountDto).getTotal());//在手任务(没排程的任务数)
|
|
|
+ json.put("completedCount", getPage(completedCountDto).getTotal());
|
|
|
+ json.put("allCount", getPage(dto).getTotal());//总任务数
|
|
|
+ json.put("balanceCount", json.get("allCount"));
|
|
|
+ for (ProductionScheduling productionScheduling : productionSchedulingList) {
|
|
|
+ json.put(productionScheduling.getProcessesId().toString(), productionScheduling.getQuantity());
|
|
|
+ }
|
|
|
+ return json;
|
|
|
+ }
|
|
|
+
|
|
|
}
|