コード例 #1
0
        public void BindCycleCountLocation()
        {
            DataTable         dt          = new DataTable();
            DataSet           ds          = new DataSet();
            iCycleCountClient cycleclient = new iCycleCountClient();
            CustomProfile     profile     = CustomProfile.GetProfile();
            //string Object = "Location";
            string Object = hdnobject.Value;

            string SessionID = Session.SessionID;

            try
            {
                ds = cycleclient.GetCycleCountTempDataByLoc(Object, profile.Personal.UserID, SessionID, profile.DBConnection._constr);
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    txtgridvalues.Text     = "Location";
                    grdlocation.DataSource = ds.Tables[0];
                    grdlocation.DataBind();
                }
                else
                {
                    grdlocation.DataSource = null;
                    grdlocation.DataBind();
                }
            }
            catch { }
            finally { cycleclient.Close(); }
        }
コード例 #2
0
        public void GetCycleCountRecord()
        {
            iCycleCountClient Cycle = new iCycleCountClient();

            try
            {
                if (Request.QueryString["Sequence"] != "" || Request.QueryString["Sequence"] != null || Request.QueryString["Sequence"] != "")
                {
                    da = new SqlDataAdapter("select ProductCode,LocationCode,QtyBalance,ActualQty,AdjustmentQty,Remark,AdjustLocation,DiffQty,BatchCode,SKUID,LocationID from tCycleCountDetail where ID='" + CycleDetailID + "' and CountHeadID=" + CountHeadID + "", con1);
                    da.Fill(ds);
                    dt = ds.Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        txtprodCode.Text   = dt.Rows[0]["ProductCode"].ToString();
                        txtlocCode.Text    = dt.Rows[0]["LocationCode"].ToString();
                        txtsysQty.Text     = dt.Rows[0]["QtyBalance"].ToString();
                        txtActualQty.Text  = dt.Rows[0]["ActualQty"].ToString();
                        txtAdjQty.Text     = dt.Rows[0]["DiffQty"].ToString();
                        txtbatch.Text      = dt.Rows[0]["BatchCode"].ToString();
                        hdnproductId.Value = dt.Rows[0]["SKUID"].ToString();
                        hdndiffQty.Value   = dt.Rows[0]["DiffQty"].ToString();
                        hdnfromlocID.Value = dt.Rows[0]["LocationID"].ToString();
                    }
                }
            }
            catch { }
            finally
            {
                con1.Close();
                Cycle.Close();
            }
        }
コード例 #3
0
        public void BindCycleCountProduct()
        {
            DataTable         dt          = new DataTable();
            DataSet           ds          = new DataSet();
            iCycleCountClient cycleclient = new iCycleCountClient();
            CustomProfile     profile     = CustomProfile.GetProfile();
            string            Object      = "Product";

            string SessionID = Session.SessionID;

            try
            {
                //ds = company.GetCostCenterList(long.Parse(hndCompanyid.Value), profile.DBConnection._constr);
                ds = cycleclient.GetCycleCounttempdata(Object, profile.Personal.UserID, SessionID, profile.DBConnection._constr);
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    txtgridvalues.Text       = "Product";
                    grdcyclecount.DataSource = ds.Tables[0];
                    grdcyclecount.DataBind();
                }
                else
                {
                    grdcyclecount.DataSource = null;
                    grdcyclecount.DataBind();
                }
            }
            catch { }
            finally { cycleclient.Close(); }
        }
コード例 #4
0
        private static void BulkInsertToDataBase(string Object1, long HeadID, string SessionID)
        {
            DataSet           ds          = new DataSet();
            SqlConnection     conn        = new SqlConnection("");
            iCycleCountClient cycleclient = new iCycleCountClient();

            conn.ConnectionString = ConfigurationManager.ConnectionStrings["elegantcrm7ConnectionString"].ConnectionString;
            conn.Open();
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                DataTable     dt      = new DataTable();
                ds = cycleclient.GetCycleTempDataToInsert(Object1, profile.Personal.UserID, SessionID, profile.DBConnection._constr);
                dt = ds.Tables[0];
                DataRow row = dt.NewRow();
                dt.Columns.Add("CycleHeadID", typeof(System.Int64));
                dt.Columns["CycleHeadID"].Expression = HeadID.ToString();
                cycleclient.SaveCyclePlanData(dt, profile.DBConnection._constr);
            }
            catch { }
            finally
            {
                cycleclient.Close();
                conn.Close();
            }
        }
コード例 #5
0
        public static void SaveCycleProductIds(string selectedIds, string Object, string SessionID)
        {
            iCycleCountClient CycleClient = new iCycleCountClient();

            try
            {
                CustomProfile  profile   = CustomProfile.GetProfile();
                CycleCountTemp cycletemp = new CycleCountTemp();
                cycletemp.Object       = Object.ToString();
                cycletemp.SessionID    = SessionID.ToString();
                cycletemp.CreatedBy    = profile.Personal.UserID;
                cycletemp.CreationDate = DateTime.Now;
                string   ids   = selectedIds.ToString();
                string[] words = ids.Split(',');
                for (int i = 0; i < words.Length; i++)
                {
                    // long ProductID = long.Parse(words[i]);
                    cycletemp.ReferenceID = long.Parse(words[i]);
                    CycleClient.SaveCycleCounttemp(cycletemp, profile.DBConnection._constr);
                }
            }
            catch (Exception ex)
            {
                //Login.Profile.ErrorHandling(ex, this, "CycleSkuSearch", "SaveCycleProductIds");
            }
            finally
            {
                CycleClient.Close();
            }
        }
コード例 #6
0
        public void DeleteCycleTempData(string SessionID)
        {
            iCycleCountClient cycleclient = new iCycleCountClient();
            CustomProfile     profile     = CustomProfile.GetProfile();

            cycleclient.DeleteCycleTempWithoutObj(profile.Personal.UserID, SessionID, profile.DBConnection._constr);
            cycleclient.Close();
        }
コード例 #7
0
        public static List <contact> GetBatchCodeBySKU(object objReq)
        {
            iCycleCountClient cycle   = new iCycleCountClient();
            CustomProfile     profile = CustomProfile.GetProfile();
            DataSet           ds      = new DataSet();
            DataTable         dt      = new DataTable();
            List <contact>    LocList = new List <contact>();

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)objReq;

                long WarehouseID = long.Parse(dictionary["WarehouseID"].ToString());
                long SKUID       = long.Parse(dictionary["SKUID"].ToString());
                long locationID  = long.Parse(dictionary["locationID"].ToString());

                //ds = StatutoryClient.GetCustomerList(ddlcompanyId, profile.DBConnection._constr);
                ds = cycle.GetBatchCodeBySKU(SKUID, locationID, profile.DBConnection._constr);
                dt = ds.Tables[0];
                contact Loc = new contact();
                Loc.Name = "--Select--";
                Loc.Id   = "0";
                LocList.Add(Loc);
                Loc = new contact();
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Loc.Id   = dt.Rows[i]["ID"].ToString();
                        Loc.Name = dt.Rows[i]["BatchCode"].ToString();
                        LocList.Add(Loc);
                        Loc = new contact();
                    }
                }
            }
            catch
            {
            }
            finally
            {
                cycle.Close();
            }
            return(LocList);
        }
コード例 #8
0
        public void BindCycleMainGrid()
        {
            iCycleCountClient cycle = new iCycleCountClient();

            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                grdcyclecount.DataSource = cycle.GetCycleCountMain(profile.DBConnection._constr);                                             //GetCycleCountMain(profile.DBConnection._constr);
                grdcyclecount.DataBind();
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, this, "Warehouse Master", "MainCustomerGridBind");
            }
            finally
            {
                cycle.Close();
            }
        }
コード例 #9
0
        public static string CheckSKUInPlan(string SKUCode, string CycleHeadID, string WarehouseID, string Object, string locationID)
        {
            string            result = "";
            string            SKU    = "";
            long              Count;
            long              SKUId   = 0;
            iCycleCountClient cycle   = new iCycleCountClient();
            CustomProfile     profile = CustomProfile.GetProfile();

            try
            {
                SKUId = cycle.GetSKUIDBySKUCode(SKUCode.Trim(), long.Parse(WarehouseID), profile.DBConnection._constr);
                SKU   = SKUId.ToString();
                if (SKUId != 0)
                {
                    Count = cycle.CheckLocInPlann(Object, long.Parse(CycleHeadID), SKUId, profile.DBConnection._constr);

                    if (Count <= 0)
                    {
                        result = "Not In Plan";
                    }
                }

                else
                {
                    result = "SKU Not Found";
                }

                result = result + "-" + SKU;
            }
            catch { }
            finally
            {
                cycle.Close();
            }

            return(result);
        }
コード例 #10
0
        public static string CheckLocInPlan(string LocationCode, string CycleHeadID, string WarehouseID, string Object)
        {
            string            result   = "";
            string            Location = "";
            long              Count;
            long              LocationID = 0;
            iCycleCountClient cycle      = new iCycleCountClient();
            CustomProfile     profile    = CustomProfile.GetProfile();

            try
            {
                LocationID = cycle.GetLocationID(LocationCode.Trim(), long.Parse(WarehouseID), profile.DBConnection._constr);
                Location   = LocationID.ToString();
                if (LocationID != 0)
                {
                    Count = cycle.CheckLocInPlann(Object, long.Parse(CycleHeadID), LocationID, profile.DBConnection._constr);

                    if (Count <= 0)
                    {
                        result = "Not In Plan";
                    }
                }

                else
                {
                    result = "Location Not Found";
                }

                result = result + "-" + Location;
            }
            catch { }
            finally
            {
                cycle.Close();
            }

            return(result);
        }
コード例 #11
0
        public static string PMSaveWLocation(object Plans)
        {
            string            result = "";
            CustomProfile     profile = CustomProfile.GetProfile();
            iCycleCountClient cycleclient = new iCycleCountClient();
            tCycleCountHead   cycleH = new tCycleCountHead();
            string            ContBasis = "", SessionID = "";

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)Plans;

                cycleH.Title       = dictionary["Title"].ToString();
                cycleH.WarehouseID = long.Parse(dictionary["WarehouseID"].ToString());
                cycleH.Status      = dictionary["Status"].ToString();
                cycleH.Frequency   = dictionary["Frequency"].ToString();
                string Frequency = dictionary["Frequency"].ToString();
                cycleH.CountBasis = dictionary["CountBasis"].ToString();
                cycleH.Active     = "Yes";
                ContBasis         = dictionary["CountBasis"].ToString();
                SessionID         = dictionary["session"].ToString();

                DateTime FromDate  = DateTime.Parse(dictionary["FromDate"].ToString());
                DateTime ToDate    = DateTime.Parse(dictionary["ToDate"].ToString());
                TimeSpan days      = ToDate - FromDate;
                long     DaysNo    = long.Parse(days.TotalDays.ToString());
                long     totaldays = 0;
                int      i         = 0;
                int      j         = 0;
                int      ival;
                if (Frequency == "Daily")
                {
                    if (DaysNo >= 12)
                    {
                        result = "More Than Daily";
                    }
                    else
                    {
                        totaldays = DaysNo;
                    }
                }
                else if (Frequency == "Weekly")
                {
                    if (DaysNo >= 84)
                    {
                        result = "More Than Weekly";
                    }
                    else
                    {
                        double dayst = DaysNo / 7;
                        totaldays = long.Parse(Math.Round(dayst).ToString());
                    }
                }
                else if (Frequency == "Monthly")
                {
                    if (DaysNo >= 365)
                    {
                        result = "More Than Monthly";
                    }
                    else
                    {
                        double dayst = DaysNo / 30;
                    }
                }
                else if (Frequency == "Quarterly")
                {
                    if (DaysNo >= 1080)
                    {
                        result = "More Than Quarterly";
                    }
                    else
                    {
                        double dayst = DaysNo / 90;
                        totaldays = long.Parse(Math.Round(dayst).ToString());
                    }
                }

                if (result == "")
                {
                    for (i = 0; i <= totaldays; i++)
                    {
                        cycleH.CycleCountDate = FromDate.AddDays(j);
                        long CycleHeadID = cycleclient.SaveCycleCountHead(cycleH, profile.DBConnection._constr);
                        BulkInsertToDataBase(ContBasis, CycleHeadID, SessionID);

                        if (Frequency == "Daily")
                        {
                            j = j + 1;
                        }
                        else if (Frequency == "Weekly")
                        {
                            j = j + 7;
                        }
                        else if (Frequency == "Monthly")
                        {
                            j = j + 30;
                        }
                        else if (Frequency == "Quarterly")
                        {
                            j = j + 90;
                        }
                    }
                    result = "Cycle saved successfully";
                    DeleteFromCycleTempData(ContBasis, SessionID);
                }
            }
            catch
            {
                result = "Some error occurred";
                DeleteFromCycleTempData(ContBasis, SessionID);
            }
            finally
            {
                cycleclient.Close();
            }

            return(result);
        }
コード例 #12
0
        public static string GetlocationQty(object objReq)
        {
            iCycleCountClient Cycle   = new iCycleCountClient();
            CustomProfile     profile = CustomProfile.GetProfile();
            tCycleCountDetail Dcycle  = new tCycleCountDetail();
            string            result  = "";

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)objReq;

                string  ProductCode   = dictionary["ProductCode"].ToString();
                string  locationcode  = dictionary["Location"].ToString();
                long    ProductID     = long.Parse(dictionary["ProductID"].ToString());
                long    LocationID    = long.Parse(dictionary["FromLocID"].ToString());
                string  BatchCode     = dictionary["BatchCode"].ToString();
                decimal SystemQty     = decimal.Parse(dictionary["SystemQty"].ToString());
                decimal ActualQty     = decimal.Parse(dictionary["ActualQty"].ToString());
                decimal AjustmentQty  = decimal.Parse(dictionary["AjustmentQty"].ToString());
                string  Remark        = dictionary["Remark"].ToString();
                string  AdjustLoc     = dictionary["AdjustmentLocIds"].ToString();
                long    CycleHeadID   = long.Parse(dictionary["CycleHeadID"].ToString());
                long    CycleDetailID = long.Parse(dictionary["CycleDetailID"].ToString());

                string[] ToLocIds     = AdjustLoc.Split(',');
                decimal  calculateQty = AjustmentQty;



                Cycle.UpdateStockSkuTransForFromLoc(ProductID, BatchCode, LocationID, AjustmentQty, profile.DBConnection._constr);

                for (int i = 0; i < ToLocIds.Length; i++)
                {
                    long    ToLocID  = long.Parse(ToLocIds[i].ToString());
                    decimal availQty = Cycle.getLocationRemainingQty(ToLocID, profile.DBConnection._constr);       // need to craete sp add in domain ninterface and build
                    if (calculateQty > availQty)
                    {
                        calculateQty = calculateQty - availQty;
                        Cycle.UpdateStocktransToLoc(ProductID, BatchCode, calculateQty, ToLocID, profile.Personal.UserID, CycleHeadID, profile.DBConnection._constr);    // need to Add CompanyID,CustomerID and UserID
                    }
                    else
                    {
                        Cycle.UpdateStocktransToLoc(ProductID, BatchCode, calculateQty, ToLocID, profile.Personal.UserID, CycleHeadID, profile.DBConnection._constr);     // need to Add CompanyID,CustomerID and UserID
                        calculateQty = 0;
                    }
                }

                Dcycle.ID             = CycleDetailID;
                Dcycle.CountHeadID    = CycleHeadID;
                Dcycle.QtyBalance     = SystemQty;
                Dcycle.ActualQty      = ActualQty;
                Dcycle.DiffQty        = AjustmentQty;
                Dcycle.AdjustmentQty  = AjustmentQty;
                Dcycle.Remark         = Remark;
                Dcycle.AdjustLocation = AdjustLoc;
                Dcycle.ProductCode    = ProductCode;
                Dcycle.LocationCode   = locationcode;
                Dcycle.SKUID          = ProductID;
                Dcycle.LocationID     = LocationID;
                Dcycle.BatchCode      = BatchCode;
                Dcycle.CreatedBy      = profile.Personal.UserID.ToString();
                Dcycle.CreationDate   = DateTime.Now;
                long CycleDtailID = Cycle.SaveCycleCount(Dcycle, profile.DBConnection._constr);



                /*decimal ClosingBalOutProd = Cycle.GetClosingBalance(Parameter, AjustmentQty, ProductID, LocationID);
                 * decimal ClosingBalInProd = Cycle.GetClosingBalance(param, AjustmentQty, ProductID, AdjustLoc);
                 * decimal AdjustmentSUMOut = Cycle.GetAdjustmentSUM(AjustmentQty, ProductID, LocationID);
                 * decimal AdjustmentSUMIN = Cycle.GetAdjustmentSUM(AjustmentQty, ProductID, AdjustLoc);*/

                // Cycle.UpdateCycleCountDetail(AjustmentQty, Remark, CreatedBy, DateTime.Now.Date, ProductCode, CycleHeadID, AdjstmentLoc);
                // // write method for transaction Entries One for out product and one for In product
                // Cycle.InsertTransactionAdjustment("Cycle Count", CycleHeadID, ProductID, LocationID, AdjustLoc, Remark, CreatedBy, DateTime.Now.Date, DateTime.Now.Date, AjustmentQty);

                // // update tinventry AdjustmentQty & QtyBalance for Out transaction
                // Cycle.UpdateInventryForOut(AdjustmentSUMOut, ClosingBalOutProd, ProductID, LocationID);


                // if records of ClosingBalIn product Is not inserted then we have to insert that and if present then update that

                /*   long CheckEntry = Cycle.GetCountTOCheckEntryInInventry(AdjustLoc, ProductID);
                 * if (CheckEntry > 0)
                 * {
                 *     Cycle.UpdateInventryForOut(AdjustmentSUMIN, ClosingBalInProd, ProductID, AdjustLoc);
                 * }
                 * else
                 * {
                 *     Cycle.InsertInventryCycleCount(ProductID, AdjustLoc, "Secondary", AjustmentQty, AjustmentQty, AjustmentQty, CreatedBy, DateTime.Now.Date, "Inventory_Inventory");
                 * }*/


                result = "Adjustment successful";
            }
            catch { result = "Some error occurred"; }
            finally
            {
                Cycle.Close();
            }
            return(result);
        }