private double SAPGetBalanceQuantity(string productCode, string warehouseCode, string unitCode, string branchCode)
        {
            using (SAP.Connector.SAPConnection sapConnection = new SAP.Connector.SAPConnection(GlobalContext.SapDestination))
            {
                using (SAPProxy.UWProxy prx = new SAPProxy.UWProxy())
                {
                    prx.Connection = sapConnection;
                    double dQty = 0.00;
                    SAPProxy.BAPIRETURN     Return       = new SAPProxy.BAPIRETURN();
                    SAPProxy.BAPIMGVMATNR   Material_Evg = new SAPProxy.BAPIMGVMATNR();
                    SAPProxy.BAPIWMDVETable tbWmdVex     = new SAPProxy.BAPIWMDVETable();
                    SAPProxy.BAPIWMDVSTable tbWmdVsx     = new SAPProxy.BAPIWMDVSTable();
                    var     sapProductCode     = SapProductCodeFormated(productCode);
                    string  sPlant             = branchCode;
                    var     sCheck_Rule        = "B";
                    var     sItm_Number        = "000000";
                    var     sBatch             = "";
                    var     sCustomer          = "";
                    var     sDoc_Number        = "";
                    string  sRead_Atp_Lock_X   = "";
                    var     sWbs_Elem          = "";
                    var     sStock_Ind         = "";
                    string  sDialogFlag        = "";
                    var     sEndLeadTme        = "";
                    var     sDec_ForRounding_X = "";
                    var     sRead_Atp_Lock     = "";
                    decimal dlAv_Qty_Plt       = 0;
                    short   shDec_ForRounding  = 0;
                    prx.Bapi_Material_Availability(sBatch, sCheck_Rule, sCustomer, shDec_ForRounding
                                                   , sDec_ForRounding_X, sDoc_Number, sItm_Number
                                                   , sapProductCode, Material_Evg, sPlant, sRead_Atp_Lock
                                                   , sRead_Atp_Lock_X, warehouseCode, sStock_Ind, unitCode
                                                   , sWbs_Elem, out dlAv_Qty_Plt, out sDialogFlag
                                                   , out sEndLeadTme, out Return, ref tbWmdVex, ref tbWmdVsx);

                    foreach (SAPProxy.BAPIWMDVE item in tbWmdVex)
                    {
                        dQty = Convert.ToDouble(item.Com_Qty);
                    }


                    return(dQty);
                }
            }
        }
Exemple #2
0
        private double SAPGetBalanceQuantity(string productCode, string warehouseCode, string unitCode, string branchCode)
        {
            using (SAP.Connector.SAPConnection sapConnection = new SAP.Connector.SAPConnection(GlobalContext.SapDestination))
            {
                using (SAPProxy.UWProxy prx = new SAPProxy.UWProxy())
                {
                    prx.Connection = sapConnection;
                    double dQty = 0.00;
                    SAPProxy.BAPIRETURN     Return       = new SAPProxy.BAPIRETURN();
                    SAPProxy.BAPIMGVMATNR   Material_Evg = new SAPProxy.BAPIMGVMATNR();
                    SAPProxy.BAPIWMDVETable tbWmdVex     = new SAPProxy.BAPIWMDVETable();
                    SAPProxy.BAPIWMDVSTable tbWmdVsx     = new SAPProxy.BAPIWMDVSTable();
                    productCode = SapProductCodeFormated(productCode);
                    var     checkRule       = "B";
                    var     itemNumber      = "000000";
                    var     batch           = "";
                    var     customer        = "";
                    var     docNumber       = "";
                    string  readAtpLockX    = "";
                    var     wbsElement      = "";
                    var     stockIndex      = "";
                    string  dialogFlag      = "";
                    var     endLeadTime     = "";
                    var     decForRoundingX = "";
                    var     readAtpLock     = "";
                    decimal dlAv_Qty_Plt    = 0;
                    short   decForRounding  = 0;
                    prx.Bapi_Material_Availability(batch, checkRule, customer, decForRounding
                                                   , decForRoundingX, docNumber, itemNumber
                                                   , productCode, Material_Evg, branchCode, readAtpLock
                                                   , readAtpLockX, warehouseCode, stockIndex, unitCode
                                                   , wbsElement, out dlAv_Qty_Plt, out dialogFlag
                                                   , out endLeadTime, out Return, ref tbWmdVex, ref tbWmdVsx);

                    foreach (SAPProxy.BAPIWMDVE item in tbWmdVex)
                    {
                        dQty = Convert.ToDouble(item.Com_Qty);
                    }

                    return(dQty);
                }
            }
        }