コード例 #1
0
        public OrderGoodsOrderResult Save(string werks, string buDat, [FromBody] OrderGoodsParam orderGoods)
        {
            OrderGoodsOrderResult result = FreshFoodOrderService.SaveFreshFoods(werks, buDat, orderGoods.orderGoods);

            return(result);
        }
コード例 #2
0
        public OrderGoodsOrderResult SaveFreshFoods(string werks, string buDat, List <OrderGoods> orderGoods)
        {
            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);

            List <FreshFoodOrderList> freshFoodOrderList = new List <FreshFoodOrderList>();
            FreshFoodOrderList        f = null;

            foreach (OrderGoods o in orderGoods)
            {
                f = new FreshFoodOrderList();

                f.LIFNR = o.LIFNR;
                f.MATNR = o.MATNR;
                f.MAKTX = o.MAKTX;

                f.MENGE          = o.MENGE;
                f.MENGESpecified = true;

                f.UMREZ          = o.UMREZ;
                f.UMREZSpecified = true;

                f.LFDAT          = o.LFDAT;
                f.LFDATSpecified = true;

                f.NETPR          = o.NETPR;
                f.NETPRSpecified = true;

                f.LABST          = o.LABST;
                f.LABSTSpecified = true;

                f.ICON  = o.ICON;
                f.ICON1 = o.ICON1;

                f.NAME1 = o.NAME1;

                f.MEINS          = o.MEINS;
                f.WAKFG          = o.WAKFG;
                f.MSTAE          = o.MSTAE;
                f.TDYMG          = o.TDYMG;
                f.TDYMGSpecified = true;

                f.MENG1          = o.MENG1;
                f.TDYMGSpecified = true;

                f.MENG2          = o.MENG2;
                f.MENG2Specified = true;

                f.MENG3          = o.MENG3;
                f.MENG3Specified = true;

                f.MENG0          = o.MENG0;
                f.MENG0Specified = true;

                f.TNETPR = o.TNETPR;
                f.BANFN  = o.BANFN;
                f.EBELN1 = o.EBELN1;
                f.REMARK = o.REMARK;

                f.LQTY7          = o.LQTY7;
                f.LQTY7Specified = true;

                f.LQTY6          = o.LQTY6;
                f.LQTY6Specified = true;

                f.LQTY5          = o.LQTY5;
                f.LQTY5Specified = true;

                f.LQTY4          = o.LQTY4;
                f.LQTY4Specified = true;

                f.LQTY3          = o.LQTY3;
                f.LQTY3Specified = true;

                f.WEQTY          = o.WEQTY;
                f.WEQTYSpecified = true;

                f.YEQTY          = o.YEQTY;
                f.YEQTYSpecified = true;

                f.TOQTY          = o.TOQTY;
                f.TOQTYSpecified = true;

                f.TOTAL          = o.TOTAL;
                f.TOTALSpecified = true;

                f.EISBE          = o.EISBE;
                f.EISBESpecified = true;

                f.DDATE          = o.DDATE;
                f.DDATESpecified = true;

                f.WERKS = o.WERKS;
                f.EKGRP = o.EKGRP;

                freshFoodOrderList.Add(f);
            }

            FreshFoodOrderCrQuery_sync param = new FreshFoodOrderCrQuery_sync();

            param.WERKS              = werks;
            param.BUDAT              = dt;
            param.BUDATSpecified     = true;
            param.FreshFoodOrderList = freshFoodOrderList.ToArray();

            FreshFoodOrderCrResponse_sync res = soapClient.FreshFoodOrderCrQueryResponse_In(param);


            OrderGoodsOrderResult result = new OrderGoodsOrderResult();

            result.Flag                 = res.Flag;
            result.ReturnMessage        = res.ReturnMessage;
            result.orderGoodsResultItem = new List <OrderGoodsResultItem>();

            OrderGoodsResultItem item = null;

            foreach (FreshFoodOrderList i in res.FreshFoodOrderList)
            {
                item       = new OrderGoodsResultItem();
                item.BANFN = i.BANFN;
                item.MAKTX = i.MAKTX;

                result.orderGoodsResultItem.Add(item);
            }

            return(result);
        }