package com.zzsmart.qomo.kn.cost.manage.plugin.webservice;

import java.util.HashMap;

public class RequestSapXmlData600 {

    public static String getOrderState(HashMap map) {
        StringBuilder sb = new StringBuilder();
        sb.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:soap:functions:mc-style\">"

                + "<soapenv:Header/>"
                + "<soapenv:Body>"
                + "<urn:ZsapDsj001>"
                + "<IsInput>"
                + "<Dest><DestId>PLM</DestId><BussTp>ZHA056_IFS003</BussTp><MessId></MessId><BussDoc></BussDoc><Status></Status><MessIdP></MessIdP><MessText></MessText><MessIdOs></MessIdOs><BussDocOs></BussDocOs><StatusOs></StatusOs></Dest>"
                + "<Data>"
                + "<IWerks>"
                + map.get("werks").toString()
                + "</IWerks>"
                + "<IMatnr>"
                + map.get("matnr").toString()
                + "</IMatnr>"
                + "<IPsPspPnr>"
                + map.get("pspnr").toString()
                + "</IPsPspPnr>"
                + "<DateB>"
                + map.get("dateb").toString()
                + "</DateB>"
                + "<DateE>"
                + map.get("datee").toString()
                + "</DateE>"
                + "<Months>"
                + map.get("months").toString()
                + "</Months>"
                + "</Data>"
                + "</IsInput></urn:ZsapDsj001></soapenv:Body></soapenv:Envelope>");

        return sb.toString().replaceAll("null", "");
    }

    public static String getDSJ002(HashMap map) {
        StringBuilder sb = new StringBuilder();
        //sb.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">"
        sb.append("<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">"
                + "<soap:Header/>"
                + "<soap:Body>"
                + "<urn:ZSAP_DSJ_002>"
                + "<IS_INPUT>"
                + "<Dest><DEST_ID>DSJ</DEST_ID><BUSS_TP>ZSAP_DSJ_002</BUSS_TP></Dest>"
                + "<DATA>"
                + "<WERKS>"
                + map.get("werks").toString()
                + "</WERKS>");
                //+ "<MATNR><item>");
        if (!map.get("matnr").toString().equals("")) {
            sb.append("<MATNR><item><MATNR>"
                    + map.get("matnr").toString()
                    + "</MATNR></item></MATNR>");
        }
        if (!map.get("zthzq").toString().equals("")) {
            sb.append("<ZTHZQ><item><ZTHZQ>"
                    + map.get("zthzq").toString()
                    + "</ZTHZQ></item></ZTHZQ>");
        }
        if (!map.get("matnr_l").toString().equals("")) {
            sb.append("<MATNR_L><item><MATNR>"
                    + map.get("matnr_l").toString()
                    + "</MATNR></item></MATNR_L>");
        }
        if (!map.get("zthzq_l").toString().equals("")) {
            sb.append("<ZTHZQ_L><item><ZTHZQ>"
                    + map.get("zthzq_l").toString()
                    + "</ZTHZQ></item></ZTHZQ_L>");
        }
//                +"<ZTHZQ>"
//                +map.get("zthzq").toString()
//                +"</ZTHZQ>"
//                +"<MATNR_L>"
//                +map.get("matnr_l").toString()
//                +"</MATNR_L>"
//                +"<ZTHZQ_L>"
//                +map.get("zthzq_l").toString()
//                +"</ZTHZQ_L>"
        sb.append("</DATA>"
                + "</IS_INPUT></urn:ZSAP_DSJ_002></soap:Body></soap:Envelope>");

        return sb.toString().replaceAll("null", "");
    }

    public static String getDSJ003(HashMap map) {
        StringBuilder sb = new StringBuilder();
        //sb.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">"
        sb.append("<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">"
                + "<soap:Header/>"
                + "<soap:Body>"
                + "<urn:ZSAP_DSJ_003>"
                + "<IS_INPUT>"
                + "<Dest><DEST_ID>DSJ</DEST_ID><BUSS_TP>ZSAP_DSJ_003</BUSS_TP></Dest>"
                + "<DATA>"
                + "<MATNR>"
                + map.get("matnr").toString()
                + "</MATNR>"
                + "<WERKS><item><WERKS>"
                + map.get("werks").toString()
                + "</WERKS></item></WERKS>"
                + "</DATA>"
                + "</IS_INPUT></urn:ZSAP_DSJ_003></soap:Body></soap:Envelope>");

        return sb.toString().replaceAll("null", "");
    }

    public static String getDSJ004(HashMap map) {
        StringBuilder sb = new StringBuilder();
        //sb.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">"
        sb.append("<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">"
                + "<soap:Header/>"
                + "<soap:Body>"
                + "<urn:ZSAP_DSJ_004>"
                + "<IS_INPUT>"
                + "<Dest><DEST_ID>DSJ</DEST_ID><BUSS_TP>ZSAP_DSJ_004</BUSS_TP></Dest>"
                + "<DATA>"
//                + "<MATNR><item>"
//                + map.get("matnr").toString()
//                + "</MATNR>"
                + "<WERKS><item><WERKS>"
                + map.get("werks").toString()
                + "</WERKS></item></WERKS>");
//                + "</DATA>"
//                + "</IS_INPUT></urn:ZSAP_DSJ_004></soapenv:Body></soapenv:Envelope>");
        if (!map.get("matnr").toString().equals("")) {
            sb.append("<MATNR><item><MATNR>"
                    + map.get("matnr").toString()
                    + "</MATNR></item></MATNR>");
        }
        if (!map.get("zthzq").toString().equals("")) {
            sb.append("<ZZTHZQ><item><ZZTHZQ>"
                    + map.get("zthzq").toString()
                    + "</ZZTHZQ></item></ZZTHZQ>");
        }
        sb.append("</DATA>"
                + "</IS_INPUT></urn:ZSAP_DSJ_004></soap:Body></soap:Envelope>");

        return sb.toString().replaceAll("null", "");
    }

    public static String getPDM(HashMap map) {
        StringBuilder sb = new StringBuilder();
        sb.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:soap:functions:mc-style\">"
        //sb.append("<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">"
                + "<soapenv:Header/>"
                + "<soapenv:Body>"
                + "<urn:ZeccPdmMm015>"
                + "<IBusexid>"
                + map.get("matnr").toString()
                + "</IBusexid>"
                + "<IMatnr>"
                + map.get("matnr").toString()
                + "</IMatnr>"
                + "<IWerks>"
                + map.get("werks").toString()
                + "</IWerks>"
                + "<OLogTab><item><Busexid></Busexid><Msgty></Msgty><Msg></Msg><Resdate></Resdate><Restime></Restime><Resname></Resname></item></OLogTab>"
                + "<OPdmTab>"
                + "<item><Matnr></Matnr><Maktx></Maktx><Zzggxh></Zzggxh><Zzthzq></Zzthzq><Meins></Meins><Werks></Werks><Lgort></Lgort><Charg></Charg><Sobkz></Sobkz><Pspnr></Pspnr><Posid></Posid><Post1></Post1><Labst></Labst><Prlab></Prlab><Vprsv></Vprsv><Fnetpr></Fnetpr><Xnetpr></Xnetpr><Waers></Waers></item>"
                + "</OPdmTab>"
                + "</urn:ZeccPdmMm015></soapenv:Body></soapenv:Envelope>");

        return sb.toString().replaceAll("null", "");
    }

    public static String getOrderState12(HashMap map) {
        StringBuilder sb = new StringBuilder();
        sb.append("<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">"

                + "<soap:Header/>"
                + "<soap:Body>"
                + "<urn:ZSAP_DSJ_005>"
                + "<IS_INPUT>"
                +"<DEST><DEST_ID>PLM</DEST_ID><BUSS_TP>ZHA056_IFS003</BUSS_TP><MESS_ID></MESS_ID><BUSS_DOC></BUSS_DOC><STATUS></STATUS><MESS_ID_P></MESS_ID_P><MESS_TEXT></MESS_TEXT><MESS_ID_OS></MESS_ID_OS><BUSS_DOC_OS></BUSS_DOC_OS><STATUS_OS></STATUS_OS></DEST>"
                + "<DATA>"
                +"<I_WERKS>"
                +map.get("werks").toString()
                +"</I_WERKS>"
                +"<I_MATNR>"
                +map.get("matnr").toString()
                +"</I_MATNR>"
                +"<I_PS_PSP_PNR>"
                +map.get("pspnr").toString()
                +"</I_PS_PSP_PNR>"
                + "<DATE_B>"
                +map.get("dateb").toString()
                + "</DATE_B>"
                + "<DATE_E>"
                +map.get("datee").toString()
                + "</DATE_E>"
                + "<MONTHS>"
                +map.get("months").toString()
                + "</MONTHS>"
                + "</DATA>"
                +"</IS_INPUT></urn:ZSAP_DSJ_005></soap:Body></soap:Envelope>");

        return sb.toString().replaceAll("null", "");
    }
}
