package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base.ep;

import cn.estsh.i3plus.ext.mes.pcn.api.base.ep.IEpQualityDecisionService;
import cn.estsh.i3plus.ext.mes.pcn.api.base.ep.IEpSxRepairWorkService;
import cn.estsh.i3plus.ext.mes.pcn.api.base.ep.IEpSxSyncBusiService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.RepairRequestModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.ep.EpBadCellDetailModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: wangjie
 * @CreateDate: 2019/8/30 1:39 PM
 * @Description:
 **/
@Service
public class SxEpSyncBusiService implements IEpSxSyncBusiService {

    @Autowired
    private IEpQualityDecisionService qualityDecisionService;

    @Autowired
    private IEpSxRepairWorkService sxRepairWorkService;

    @Override
    public synchronized void doRepairOrQualityDecision(Object obj, Integer flag) {
        if (flag == 1) {
            qualityDecisionService.insertMesBadCellAndDetail((RepairRequestModel) obj);
        } else if (flag == 2) {
            sxRepairWorkService.insertMesBadCellDetail((EpBadCellDetailModel) obj);
        } else if (flag == 3) {
            sxRepairWorkService.insertMesRepairDefectRecord((RepairRequestModel) obj);
        }
    }
}
