package com.yem.wm.es.Util;

import com.yem.wm.utils.RequestCmmp;
import com.yem.wm.utils.YEM;
import kd.bos.context.RequestContext;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author xwudd
 * @date 9:38
 * @Description
 **/
public class DetachableLargeInfoCMMP {
    public final static String P_CODE = "pcode";//父件编码
    public final static String C_CODE = "ccode";//子件编码
    public final static String QTY = "qty";//数量

    public static List<Map> DetachableLargeInfo(Map<String,Object> map,Long id){
        String sql = "select pcode,ccode,qty from VIEW_BASE_ITEMSTRUC_WM ";
        long orgId = RequestContext.get().getOrgId();
        String pCode = (String)map.get(P_CODE);//物料编码
        if(YEM.isEmpty(pCode)){
            return new ArrayList<>();
        }
        StringBuffer where = new StringBuffer(String.format("where %s = '%s'",P_CODE,pCode));
        sql = sql + where.toString();
        List<Map> fromCmmp = RequestCmmp.getFromCmmp(orgId, sql,id);
        return fromCmmp;
    }
}
