package com.sw.mes.itemclean.clean.mapping;

import com.sw.mes.itemclean.clean.domain.MaterialBrokenDown;
import com.sw.mes.itemclean.clean.domain.MaterialStoreSignBox;
import com.sw.mes.itemclean.clean.dto.BoxPropertyDto;
import com.sw.mes.itemclean.clean.service.ScanBoxNoService;
import com.sw.mes.itemclean.clean.service.impl.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author liuzemin
 * @date 2022/11/11 10:30
 * @description
 */
public class ScanBoxNoMapping {

    public static Map<String,Class> types = new HashMap<>();

    static {
        types.put("原生多晶领料", MaterialApplyOrderServiceImpl.class);
        types.put("回收料领料", MaterialApplyOrderServiceImpl.class);
        types.put("落地料领料", MaterialApplyOrderServiceImpl.class);
        types.put("返工领料", MaterialApplyOrderServiceImpl.class);
        types.put("分选成箱", MaterialUnpackingServiceImpl.class);
        types.put("返工打签", MaterialReworkSignatureServiceImpl.class);
        types.put("清洗上料", MaterialCleaningServiceImpl.class);
        types.put("破碎上料", MaterialBrokenServiceImpl.class);
        types.put("组托入库", MaterialGroupServiceImpl.class);
    }

    public static Class<ScanBoxNoService> get(String buttonName) {
        return types.get(buttonName);
    }

    public static BoxPropertyDto toDto(MaterialStoreSignBox box){
        BoxPropertyDto dto = new BoxPropertyDto();
        dto.setId(box.getId());
        dto.setWeight(box.getWeight());
        dto.setMaterialBoxNo(box.getMaterialBoxNo());
        dto.setProductBatchNo(box.getProductBatchNo());
        dto.setMaterialCode(box.getMaterialCode());
        dto.setMaterialName(box.getMaterialName());
        dto.setMaterialLevel(box.getMaterialLevel());
        dto.setMaterialModel(box.getMaterialModel());
        dto.setMaterialGear(box.getMaterialGear());
        dto.setMaterialType(box.getMaterialType());
        dto.setPickingStatus(box.getPickingStatus());
        dto.setCreateUser(box.getCreateUser());
        dto.setCreateTime(box.getCreateTime());
        dto.setUpdateUser(box.getUpdateUser());
        dto.setUpdateTime(box.getUpdateTime());
        dto.setDelFlag(box.getDelFlag());
        dto.setBoxNo(box.getBoxNo());
        dto.setMaterialResource(box.getMaterialResource());
        return dto;
    }

    public static BoxPropertyDto toGroupItemDto(MaterialBrokenDown materialBrokenDown){
        BoxPropertyDto dto = new BoxPropertyDto();
        dto.setId(materialBrokenDown.getId());
        dto.setWeight(materialBrokenDown.getWeight());
        dto.setMaterialBoxNo(materialBrokenDown.getMaterialBoxNo());
        dto.setProductBatchNo(materialBrokenDown.getProductBatchNo());
        dto.setMaterialCode(materialBrokenDown.getMaterialCode());
        dto.setMaterialName(materialBrokenDown.getMaterialName());
        dto.setMaterialLevel(materialBrokenDown.getMaterialLevel());
        dto.setMaterialModel(materialBrokenDown.getMaterialModel());
        dto.setMaterialGear(materialBrokenDown.getMaterialGear());
//        dto.setMaterialType(materialBrokenDown.getMaterialType());
//        dto.setPickingStatus(materialBrokenDown.getPickingStatus());
        dto.setCreateUser(materialBrokenDown.getCreateUser());
        dto.setCreateTime(materialBrokenDown.getCreateTime());
        dto.setUpdateUser(materialBrokenDown.getUpdateUser());
        dto.setUpdateTime(materialBrokenDown.getUpdateTime());
        dto.setDelFlag(materialBrokenDown.getDelFlag());
//        dto.setMaterialResource(materialBrokenDown.getMaterialResource());
        return dto;
    }

}
