示例#1
0
        public String GetSaveStock(string MATNR, string WERKS)
        {
            QueryMaterialPriceInfoClient client = new QueryMaterialPriceInfoClient();

            client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_USERNAME"];
            client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_PASSWORD"];

            MaterialPriceInfoQuery_sync param = new MaterialPriceInfoQuery_sync();

            param.MATNR = MATNR;
            param.WERKS = WERKS;

            MaterialPriceInfoResponse_sync respone = client.MaterialPriceInfoQueryResponse_In(param);

            string maktx = string.Empty;

            if (respone != null && respone.MaterialPriceList != null)
            {
                maktx = respone.MaterialPriceList.FirstOrDefault().MAKTX;
            }

            return(maktx);
        }
示例#2
0
        public List <Domain.MaterialPriceInfo> GetMaterialPriceInforListAll(string burks, string matnr)
        {
            List <Domain.MaterialPriceInfo> list = new List <Domain.MaterialPriceInfo>();

            Domain.MaterialPriceInfo dto = null;

            QueryMaterialPriceInfoClient client = new QueryMaterialPriceInfoClient();

            client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_USERNAME"];
            client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_PASSWORD"];

            MaterialPriceInfoAllQuery_sync param = new MaterialPriceInfoAllQuery_sync();

            param.BUKRS = burks;
            param.MATNR = matnr;

            MaterialPriceInfoResponse_sync respone = client.MaterialPriceInfoAllQueryResponse_In(param);

            if (respone != null && respone.MaterialPriceList != null)
            {
                foreach (MaterialPriceList item in respone.MaterialPriceList)
                {
                    dto               = new Domain.MaterialPriceInfo();
                    dto.bISMT         = item.BISMT;
                    dto.dATAB         = item.DATAB;
                    dto.dPTPR         = item.DPTPR;
                    dto.eAN11         = item.EAN11;
                    dto.eKGRP         = item.EKGRP;
                    dto.gESME         = item.GESME;
                    dto.gUBUN         = item.GUBUN;
                    dto.gUBUN_T       = item.GUBUN_T;
                    dto.kONWA         = item.KONWA;
                    dto.lABST         = item.LABST;
                    dto.lABST_1       = item.LABST_1;
                    dto.mAKTX         = item.MAKTX;
                    dto.mATNR         = item.MATNR;
                    dto.mATNR1        = item.MATNR1;
                    dto.mEINS         = item.MEINS;
                    dto.nOCTL         = item.NOCTL;
                    dto.pERNO         = item.PERNO;
                    dto.pRICE         = item.PRICE;
                    dto.sTPRC         = item.STPRC;
                    dto.tOQTY         = item.TOQTY;
                    dto.tOTAL         = item.TOTAL;
                    dto.wERKS         = item.WERKS;
                    dto.zCNT          = item.ZCNT;
                    dto.zFLAG         = item.ZFLAG;
                    dto.zFLAG_T       = item.ZFLAG_T;
                    dto.zRSUM         = item.ZRSUM;
                    dto.Flag          = respone.Flag;
                    dto.ReturnMessage = respone.ReturnMessage;

                    list.Add(dto);
                }
            }
            else
            {
                dto               = new Domain.MaterialPriceInfo();
                dto.Flag          = respone.Flag;
                dto.ReturnMessage = respone.ReturnMessage;
                list.Add(dto);
            }


            return(list);
        }
示例#3
0
        public Domain.MaterialInforDetail GetMaterialInforDetail(Domain.MaterialPriceInfo materialPrice)
        {
            Domain.MaterialInforDetail returnDto = null;//new Domain.MaterialInforDetail();

            List <Domain.MaterialInforDetail> list = new List <Domain.MaterialInforDetail>();

            QueryMaterialPriceInfoClient client = new QueryMaterialPriceInfoClient();

            client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_USERNAME"];
            client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_PASSWORD"];

            MaterialInformationQuery_sync param = new MaterialInformationQuery_sync();

            MaterialPriceList dto = new MaterialPriceList();

            dto.BISMT            = materialPrice.bISMT;
            dto.DATAB            = materialPrice.dATAB;
            dto.DATABSpecified   = true;
            dto.DPTPR            = materialPrice.dPTPR;
            dto.DPTPRSpecified   = true;
            dto.EAN11            = materialPrice.eAN11;
            dto.EKGRP            = materialPrice.eKGRP;
            dto.MATNR            = materialPrice.mATNR;
            dto.WERKS            = materialPrice.wERKS;
            dto.GESMESpecified   = true;
            dto.LABST_1Specified = true;
            dto.LABSTSpecified   = true;
            dto.STPRCSpecified   = true;
            dto.TOQTYSpecified   = true;
            dto.TOTALSpecified   = true;
            dto.ZCNTSpecified    = true;


            param.MaterialPriceList = dto;

            MaterialInformationResponse_sync respone = client.MaterialInformationQueryResponse_In(param);

            if (respone != null && respone.MaterialInformationList != null)
            {
                foreach (MaterialInformationList item in respone.MaterialInformationList)
                {
                    returnDto = new Domain.MaterialInforDetail()
                    {
                        bEHVO    = item.BEHVO,
                        bEHVO_T  = item.BEHVO_T,
                        lIFNR    = item.LIFNR,
                        lIFNR_TX = item.LIFNR_TX,
                        mAKTX    = item.MAKTX,
                        mATNR    = item.MATNR,
                        mEINH    = item.MEINH,
                        tAKLV    = item.TAKLV,
                        tAKLV_TX = item.TAKLV_TX,
                        vERPR    = item.VERPR,
                        wAERS    = item.WAERS,
                        zSTD     = item.ZSTD
                    };

                    list.Add(returnDto);
                }
            }

            return(list.FirstOrDefault());
        }
示例#4
0
        public OrderGoodsResult GetFreshFoods(string ekOrg, string ekGrp, string werks, string buDat, string perNo)
        {
            ManageOrderOfferProgramInClient soapClient = new ManageOrderOfferProgramInClient();

            soapClient.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_USERNAME"];
            soapClient.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_PASSWORD"];

            int year;
            int month;
            int day;

            int.TryParse(buDat.Substring(0, 4), out year);
            int.TryParse(buDat.Substring(4, 2), out month);
            int.TryParse(buDat.Substring(6, 2), out day);

            DateTime dt = new DateTime(year, month, day);

            FreshFoodOrderQuery_sync typeMParam = new FreshFoodOrderQuery_sync()
            {
                EKGRP          = ekGrp,
                WERKS          = werks,
                BUDAT          = dt,
                BUDATSpecified = true,
                PERNO          = perNo,
                ZTYPE          = "M"
            };

            FreshFoodOrderResponse_sync typeMResult = soapClient.FreshFoodOrderQueryResponse_In(typeMParam);
            ////FreshFoodOrder typeMFreshFoodOrder = new FreshFoodOrder();
            ////typeMFreshFoodOrder.E_SUBRC = typeMResult.Flag; // 0 정상, 4 에러
            ////typeMFreshFoodOrder.E_ZTEXT = typeMResult.ReturnMessage;

            //if (typeMResult.Flag == "E" || typeMResult.Flag == "4")
            //    throw new Exception(typeMResult.ReturnMessage);
            //// second call
            FreshFoodOrderQuery_sync typeAParam = new FreshFoodOrderQuery_sync()
            {
                EKGRP                   = ekGrp,
                WERKS                   = werks,
                BUDAT                   = dt,
                BUDATSpecified          = true,
                PERNO                   = perNo,
                ZTYPE                   = "A",
                MATNRFreshFoodOrderList = typeMResult.MATNRFreshFoodOrderList
            };

            FreshFoodOrderResponse_sync typeAResult = soapClient.FreshFoodOrderQueryResponse_In(typeAParam);

            //if (typeAResult.Flag == "E" || typeAResult.Flag == "4")
            //    throw new Exception(typeAResult.ReturnMessage);

            QueryMaterialPriceInfoClient client = new QueryMaterialPriceInfoClient();

            client.ClientCredentials.UserName.UserName = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_USERNAME"];
            client.ClientCredentials.UserName.Password = System.Configuration.ConfigurationManager.AppSettings["SAP_WEBSERVICE_PASSWORD"];

            List <Matnr> matnrList = new List <Matnr>();
            MaterialVendorInfoQuery_sync mParam           = null;
            OrderGoodsResult             orderGoodsResult = new OrderGoodsResult();
            List <OrderGoods>            orderGoodsList   = new List <OrderGoods>();
            OrderGoods goods = null;
            MaterialVendorInfoResponse_sync q = null;

            orderGoodsResult.Flag          = typeAResult.Flag;
            orderGoodsResult.ReturnMessage = typeAResult.ReturnMessage;
            orderGoodsResult.orderGoods    = new List <OrderGoods>();

            if (typeAResult.FreshFoodOrderList != null)
            {
                foreach (var item in typeAResult.FreshFoodOrderList)
                {
                    goods = new OrderGoods();

                    goods.LIFNR = item.LIFNR;
                    goods.MATNR = item.MATNR;
                    goods.MAKTX = item.MAKTX;
                    goods.MENGE = item.MENGE;
                    goods.UMREZ = item.UMREZ;
                    ////goods.LFDAT = item.LFDAT.ToString("MMdd");
                    goods.LFDAT = item.LFDAT;
                    goods.NETPR = item.NETPR;
                    goods.LABST = item.LABST;

                    goods.ICON  = item.ICON;
                    goods.ICON1 = item.ICON1;

                    goods.NAME1 = item.NAME1;

                    goods.MEINS = item.MEINS;
                    goods.WAKFG = item.WAKFG;
                    goods.MSTAE = item.MSTAE;
                    goods.TDYMG = item.TDYMG;
                    goods.MENG1 = item.MENG1;
                    goods.MENG2 = item.MENG2;
                    goods.MENG3 = item.MENG3;
                    goods.MENG0 = item.MENG0;

                    goods.TNETPR = item.TNETPR;
                    goods.BANFN  = item.BANFN;
                    goods.EBELN1 = item.EBELN1;
                    goods.REMARK = item.REMARK;
                    goods.LQTY7  = item.LQTY7;
                    goods.LQTY6  = item.LQTY6;
                    goods.LQTY5  = item.LQTY5;
                    goods.LQTY4  = item.LQTY4;
                    goods.LQTY3  = item.LQTY3;
                    goods.WEQTY  = item.WEQTY;
                    goods.YEQTY  = item.YEQTY;
                    goods.TOQTY  = item.TOQTY;

                    goods.TOTAL = item.TOTAL;
                    goods.EISBE = item.EISBE;
                    goods.DDATE = item.DDATE;
                    goods.WERKS = item.WERKS;
                    goods.EKGRP = item.EKGRP;

                    foreach (var matnr in typeAResult.MATNRFreshFoodOrderList)
                    {
                        if (item.MATNR == matnr.MATNR)
                        {
                            mParam       = new MaterialVendorInfoQuery_sync();
                            mParam.EKORG = ekOrg;
                            mParam.MATNR = matnr.MATNR;

                            matnrList = new List <Matnr>();
                            q         = client.MaterialVendorInfoQueryResponse_In(mParam);

                            foreach (var innerItem in q.MaterialVendorList)
                            {
                                matnrList.Add(new Matnr()
                                {
                                    MATNR   = innerItem.MATNR,
                                    LIFNR_N = string.Format("{0}-{1}", innerItem.LIFNR_N, innerItem.LIFNR),
                                    LIFNR   = innerItem.LIFNR
                                });
                            }

                            break;
                        }
                    }

                    goods.MATNRLIST = matnrList;

                    orderGoodsList.Add(goods);
                }
            }
            orderGoodsResult.orderGoods = orderGoodsList;

            return(orderGoodsResult);
        }