package com.ximai.mes.pro.schedule.impl.busi;

import com.ximai.mes.pro.schedule.impl.AlgorithmResultProcessImpl;
import com.ximai.mes.pro.service.IProMaterialRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 物料领料申请单/调拨申请单
 */
@Component
public class MaterialRequestBuild implements ScheduleBusiProcess{

    @Autowired
    private IProMaterialRequestService proMaterialRequestService;
    @Override
    public void execute(List<JobResult> jobResults) {
        //生产领料申请单
        jobResults.forEach(job->{
            job.getTaskResultList().forEach(task->{
                task.getProTaskWorkunitList().forEach(s2->{
                    proMaterialRequestService.insertProMaterialRequestIssueItem(s2.getTaskWorkunitId(), task.getProTask());
                });
            });
        });
    }

}
