|
|
|
|
@ -4,11 +4,18 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductRespVO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
|
|
|
|
|
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.app.vo.AppOrgWorkerVO;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.app.vo.AppProductVo;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.organization.vo.ProcessTypeEnum;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.controller.admin.plan.vo.PlanStatusEnum;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.organization.OrganizationDO;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.orgworker.OrgWorkerDO;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.dal.dataobject.plan.PlanDO;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.organization.OrganizationService;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.plan.PlanService;
|
|
|
|
|
import cn.iocoder.yudao.module.mes.service.producereport.ProduceReportDetailService;
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
@ -33,7 +40,12 @@ public class AppServiceImpl implements AppService {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private OrganizationService organizationService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private PlanService planService;
|
|
|
|
|
@Resource
|
|
|
|
|
private ProduceReportDetailService produceReportDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
private ErpProductService productService;
|
|
|
|
|
@Override
|
|
|
|
|
public List<AppOrgWorkerVO> getOrgList(List<OrgWorkerDO> list){
|
|
|
|
|
if (CollUtil.isEmpty(list)) {
|
|
|
|
|
@ -75,4 +87,35 @@ public class AppServiceImpl implements AppService {
|
|
|
|
|
}
|
|
|
|
|
return workerList;
|
|
|
|
|
}
|
|
|
|
|
//获取正在开工的计划某工序的报工情况
|
|
|
|
|
@Override
|
|
|
|
|
public List<AppProductVo> getPlanProductList(String orgType){
|
|
|
|
|
List<Integer> status = new ArrayList<>();
|
|
|
|
|
status.add(PlanStatusEnum.开工.getValue());
|
|
|
|
|
List<PlanDO> planList = planService.getPlanByStatus(status);
|
|
|
|
|
Map<Long, ErpProductDO> map = productService.getProductMap(
|
|
|
|
|
convertSet(planList, PlanDO::getProductId));
|
|
|
|
|
|
|
|
|
|
List<AppProductVo> appProductVoList = new ArrayList<>();
|
|
|
|
|
for (PlanDO plan :planList) {
|
|
|
|
|
Long finish = produceReportDetailService.sumByPlanAndOrgType(plan.getId(), orgType);
|
|
|
|
|
AppProductVo appProductVo = new AppProductVo().setValue(plan.getId())
|
|
|
|
|
.setProductId(plan.getProductId()).setProductName(map.get(plan.getProductId()).getName());
|
|
|
|
|
StringBuilder builder = new StringBuilder().append("[").append(plan.getCode()).append("]");
|
|
|
|
|
builder.append(map.get(plan.getProductId()).getName()).append("-");
|
|
|
|
|
if(orgType.equals(ProcessTypeEnum.热压.getValue())){
|
|
|
|
|
if(plan.getReyaNumber() - finish > 0)
|
|
|
|
|
builder.append("需:").append(plan.getReyaNumber() - finish);
|
|
|
|
|
else builder.append("超:").append(finish - plan.getReyaNumber());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(plan.getPlanNumber() - finish > 0)
|
|
|
|
|
builder.append("需:").append(plan.getPlanNumber() - finish);
|
|
|
|
|
else builder.append("超:").append(finish - plan.getPlanNumber());
|
|
|
|
|
}
|
|
|
|
|
appProductVo.setText(builder.toString());
|
|
|
|
|
appProductVoList.add(appProductVo);
|
|
|
|
|
}
|
|
|
|
|
return appProductVoList;
|
|
|
|
|
}
|
|
|
|
|
}
|