package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice;

import cn.estsh.i3plus.ext.mes.pcn.apiservice.model.*;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.DcsForEquipmentServiceImpl;
import cn.estsh.i3plus.pojo.mes.model.MesReturnModel;
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

@Component
@WebService(targetNamespace = "http://tempuri.org/")
public class DcsForEquipmentServer {
    public static final Logger LOGGER = LoggerFactory.getLogger(DcsForEquipmentServer.class);
//    @WebMethod(action = "GetConsoleItemCodeExt", operationName = "GetConsoleItemCodeExt")
//    public String getConsoleItemCodeExt(@WebParam(name = "GetConsoleItemCodeExt") MesConsoleItemCodeExt mesConsoleItemCodeExt) {
//        DcsForEquipmentServiceImpl bean = (DcsForEquipmentServiceImpl) SpringContextsUtil.getBean("dcsForEquipmentServiceImpl");
//        String organizeCode = mesConsoleItemCodeExt.getOrganizeCode();
//        String custCode = mesConsoleItemCodeExt.getCustCode();
//        String assemblyLine = mesConsoleItemCodeExt.getAssemblyLine();
//        String location = mesConsoleItemCodeExt.getLocation();
//        String barcode = mesConsoleItemCodeExt.getBarcode();
//        String custPlantCode = mesConsoleItemCodeExt.getCustPlantCode();
//        return bean.doGetConsoleItemCode(organizeCode,barcode,custCode,custPlantCode,assemblyLine,location);
//    }

    @WebMethod(action = "GetConsoleItemCodeExt", operationName = "GetConsoleItemCodeExt")
    public String getConsoleItemCodeExt(@WebParam(name = "barcode")String barcode, @WebParam(name = "custCode") String custCode,@WebParam(name = "custPlantCode")String custPlantCode,@WebParam(name = "assemblyLine")String assemblyLine,@WebParam(name = "location")String location) {
        DcsForEquipmentServiceImpl bean = (DcsForEquipmentServiceImpl) SpringContextsUtil.getBean("dcsForEquipmentServiceImpl");
        return bean.doGetConsoleItemCode(barcode,custCode,custPlantCode,assemblyLine,location);
    }


    @WebMethod(action = "FillConsoleResultExt", operationName = "FillConsoleResultExt")
    public String getConsoleItemCodeExt(@WebParam(name = "barcode")String barcode, @WebParam(name = "partNO") String partNO, @WebParam(name = "result") String result,@WebParam(name = "assemblyLine")String assemblyLine,@WebParam(name = "location")String location,@WebParam(name = "custCode") String custCode) {
        DcsForEquipmentServiceImpl bean = (DcsForEquipmentServiceImpl) SpringContextsUtil.getBean("dcsForEquipmentServiceImpl");

        return bean.doFillConsoleResultExt(barcode,partNO,result,assemblyLine,location,custCode);
    }


    @WebMethod(action = "GetConsoleItemCode", operationName = "GetConsoleItemCode")
    public String getConsoleItemCode(@WebParam(name = "GetConsoleItemCode") MesGetConsoleItemCode mesGetConsoleItemCode) {
        DcsForEquipmentServiceImpl bean = (DcsForEquipmentServiceImpl) SpringContextsUtil.getBean("dcsForEquipmentServiceImpl");
        String organizeCode = mesGetConsoleItemCode.getPlant();
        String custCode = mesGetConsoleItemCode.getCustCode();
        String barcode = mesGetConsoleItemCode.getBarcode();
        String custPlantCode = mesGetConsoleItemCode.getCustPlantCode();
        return bean.doGetConsoleItemCode(organizeCode,barcode,custCode,custPlantCode);
    }


    @WebMethod(action = "FillConsoleResult", operationName = "FillConsoleResult")
    public String fillConsoleResult(@WebParam(name = "FillConsoleResult") MesFillConsoleResult mesFillConsoleResult) {
        DcsForEquipmentServiceImpl bean = (DcsForEquipmentServiceImpl) SpringContextsUtil.getBean("dcsForEquipmentServiceImpl");
        String organizeCode = mesFillConsoleResult.getOrganizeCode();
        String assemblyLine = mesFillConsoleResult.getAssemblyLine();
        String location = mesFillConsoleResult.getLocation();
        String barcode = mesFillConsoleResult.getBarcode();
        String result = mesFillConsoleResult.getResult();
        String partNo = mesFillConsoleResult.getPartNO();
        return bean.doFillConsoleResult(organizeCode,barcode,partNo,result,assemblyLine,location);
    }

    @WebMethod(action = "GetConsoleItemCodeAndProcess", operationName = "GetConsoleItemCodeAndProcess")
    public MesReturnModel getConsoleItemCodeAndProcess(@WebParam(name = "GetConsoleItemCodeAndProcess") MesGetConsoleItemCodeAndProcess mesGetConsoleItemCodeAndProcess) {
        DcsForEquipmentServiceImpl bean = (DcsForEquipmentServiceImpl) SpringContextsUtil.getBean("dcsForEquipmentServiceImpl");
        String organizeCode = mesGetConsoleItemCodeAndProcess.getPlant();
        String custCode = mesGetConsoleItemCodeAndProcess.getCustCode();
        String barcode = mesGetConsoleItemCodeAndProcess.getBarcode();
        String custPlantCode = mesGetConsoleItemCodeAndProcess.getCustPlantCode();
        return bean.doGetConsoleItemCodeAndProcess( organizeCode,  barcode,  custCode,  custPlantCode);
    }
}
