Esempio n. 1
0
        public void AddMajorHandHeldCounterMainHoldToSap(string branchCode, string documentNo, string officerID1, string officerID2)
        {
            var    counterHolds   = GetHandHeldCounterMainHoldByDocumentNo(branchCode, documentNo);
            string accountingYear = string.Empty;
            string officerID      = string.Empty;

            SAPProxyIII.ZDD_HH_CHKSTOCKTable tables = new SAPProxyIII.ZDD_HH_CHKSTOCKTable();

            using (var sapConnection = new SAP.Connector.SAPConnection(GlobalContext.SapDestination))
            {
                using (var prx = new SAPProxyIII.UWProxy())
                {
                    prx.Connection = sapConnection;

                    foreach (var item in counterHolds)
                    {
                        var zdd = new SAPProxyIII.ZDD_HH_CHKSTOCK();
                        zdd.Iblnr       = item.Iblnr;
                        zdd.Gjahr       = item.Gjahr;
                        zdd.Zeili       = item.Zeili;
                        zdd.Matnr       = item.Matnr;
                        zdd.Ean11       = item.Ean11;
                        zdd.Maktx       = item.Maktx;
                        zdd.Shelf       = item.Shelf;
                        zdd.Bin_Code    = item.BinCode;
                        zdd.Erfmg_Sku   = item.ErfmgSku;
                        zdd.Erfme_Sku   = item.ErfmeSku;
                        zdd.Ratio       = item.Ratio;
                        zdd.Erfmg_Sales = item.ErfmgSales;
                        zdd.Erfme_Sales = item.ErfmeSales;

                        accountingYear = item.Gjahr;
                        officerID      = item.Createuser;

                        tables.Add(zdd);
                    }

                    try
                    {
                        prx.Zdd_Handheld_Checkstock(accountingYear, documentNo, "X", officerID1, officerID1, ref tables);

                        using (var db = new DbManager(branchCode))
                        {
                            db.SetCommand(GetSql(33), db.Parameter("@DocumentNo", documentNo)).ExecuteNonQuery();
                        }

                        prx.CommitWork();
                    }
                    catch (Exception ex)
                    {
                        prx.RollbackWork();
                        throw ex;
                    }
                }
            }
        }
Esempio n. 2
0
        public List <HandHeldCounterMainHold> GetHandHeldCounterMainHoldZDDHandHeldCheckStockFromSap(string branchCode, string iblnr, string Gjahr, string officerID)
        {
            using (var sapConnection = new SAP.Connector.SAPConnection(GlobalContext.SapDestination))
            {
                using (var prx = new SAPProxyIII.UWProxy())
                {
                    prx.Connection = sapConnection;
                    SAPProxyIII.PERNR pernr = new SAPProxyIII.PERNR();
                    SAPProxyIII.ZDD_HH_CHKSTOCKTable tables = new SAPProxyIII.ZDD_HH_CHKSTOCKTable();
                    pernr.Pernr = officerID;
                    prx.Zdd_Handheld_Checkstock(Gjahr, iblnr, string.Empty, string.Empty, string.Empty, ref tables);

                    var zDDHandHeldCheckStockList = new List <HandHeldCounterMainHold>();
                    foreach (SAPProxyIII.ZDD_HH_CHKSTOCK item in tables)
                    {
                        var zdd = new HandHeldCounterMainHold();
                        zdd.Matnr           = item.Matnr;
                        zdd.ProductCode     = FormatedProductCode(item.Matnr);
                        zdd.Maktx           = item.Maktx;
                        zdd.BinCode         = item.Bin_Code;
                        zdd.ErfmeSales      = item.Erfme_Sales;
                        zdd.UnitNameForSale = GetUnitByCode(branchCode, item.Erfme_Sales);
                        zdd.ErfmeSku        = item.Erfme_Sku;
                        zdd.UnitNameForSKU  = GetUnitByCode(branchCode, item.Erfme_Sku);
                        zdd.Iblnr           = item.Iblnr;
                        zdd.Gjahr           = item.Gjahr;
                        zdd.Zeili           = item.Zeili;
                        zdd.Ean11           = item.Ean11;
                        zdd.Shelf           = zdd.Shelf;
                        zdd.ErfmgSku        = item.Erfmg_Sku;
                        zdd.Ratio           = item.Ratio;
                        zdd.ErfmgSales      = item.Erfmg_Sales;

                        zDDHandHeldCheckStockList.Add(zdd);
                    }

                    return(zDDHandHeldCheckStockList);
                }
            }
        }