Example #1
0
        private void frmSuggestedKO_Load(object sender, EventArgs e)
        {
            formloaded = false;

            QueryParms = new ProdQueryParameters();
            repo       = new PPSRepository();

            using (var context = new TTI2Entities())
            {
                var Dept = context.TLADM_Departments.Where(x => x.Dep_ShortCode.Contains("KNIT")).FirstOrDefault();
                if (Dept != null)
                {
                    var ExistingMachines = context.TLADM_MachineDefinitions.Where(x => x.MD_Department_FK == Dept.Dep_Id).OrderBy(x => x.MD_MachineCode).ToList();
                    foreach (var record in ExistingMachines)
                    {
                        cmboMachine.Items.Add(new ProductionPlanning.CheckComboBoxItem(record.MD_Pk, record.MD_Description, false));
                    }

                    var ExistingGreige = context.TLADM_Griege.ToList();
                    foreach (var record in ExistingGreige)
                    {
                        cmboGreige.Items.Add(new ProductionPlanning.CheckComboBoxItem(record.TLGreige_Id, record.TLGreige_Description, false));
                    }

                    var ExistingQuality = context.TLADM_GreigeQuality.ToList();
                    foreach (var record in ExistingQuality)
                    {
                        cmboGreigeQuality.Items.Add(new ProductionPlanning.CheckComboBoxItem(record.GQ_Pk, record.GQ_Description, false));
                    }
                }

                formloaded = true;
            }
        }
Example #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = (Button)sender;

            if (oBtn != null && FormLoaded)
            {
                if (!chkCMT.Checked && !chkCutting.Checked && !chkDyePrep.Checked && !chkWhse.Checked)
                {
                    MessageBox.Show("Please select at least one Department to report on");
                    return;
                }

                if (chkDyePrep.Checked)
                {
                    ReportDepts[0] = true;
                }

                if (chkCutting.Checked)
                {
                    ReportDepts[1] = true;
                }

                if (chkCMT.Checked)
                {
                    ReportDepts[2] = true;
                }

                if (chkWhse.Checked)
                {
                    ReportDepts[3] = true;
                }


                ProductionPlanning.ProdQueryParameters QueryParms = new ProductionPlanning.ProdQueryParameters();
                QueryParms.QAReportingDepts = ReportDepts;

                DateTime FromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString());
                DateTime ToDate   = Convert.ToDateTime(dtpToDate.Value.ToShortDateString());
                ToDate = ToDate.AddHours(23);

                QueryParms.FromDate = FromDate;
                QueryParms.ToDate   = ToDate;


                frmPPSViewRep vRep = new frmPPSViewRep(6, QueryParms);
                int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog();

                frmQASDaysDelay_Load(this, null);
            }
        }
Example #3
0
        public IQueryable <TLPPS_Replenishment> PPSQuery(ProdQueryParameters parameters)
        {
            var PPSSortOrder = from T1 in _context.TLPPS_Replenishment
                               join T2 in _context.TLADM_Styles on T1.TLREP_Style_FK equals T2.Sty_Id
                               join T3 in _context.TLADM_Colours on T1.TLREP_Colour_FK equals T3.Col_Id
                               join T4 in _context.TLADM_Sizes on T1.TLREP_Size_FK equals T4.SI_id
                               orderby T2.Sty_Description, T3.Col_Display, T4.SI_DisplayOrder
            select T1;

            var PPS = PPSSortOrder.Where(x => (bool)x.TLREP_Discontinued != true).AsQueryable();

            if (parameters.Styles.Count() > 0)
            {
                var stylePredicate = PredicateBuilder.False <TLPPS_Replenishment>();
                foreach (var style in parameters.Styles)
                {
                    var temp = style;
                    stylePredicate = stylePredicate.Or(s => s.TLREP_Style_FK == temp.Sty_Id);
                }

                PPS = PPS.AsExpandable().Where(stylePredicate);
            }

            if (parameters.Colours.Count() > 0)
            {
                var colourPredicate = PredicateBuilder.False <TLPPS_Replenishment>();
                foreach (var style in parameters.Colours)
                {
                    var temp = style;
                    colourPredicate = colourPredicate.Or(s => s.TLREP_Colour_FK == temp.Col_Id);
                }

                PPS = PPS.AsExpandable().Where(colourPredicate);
            }

            if (parameters.Sizes.Count() > 0)
            {
                var sizePredicate = PredicateBuilder.False <TLPPS_Replenishment>();
                foreach (var style in parameters.Sizes)
                {
                    var temp = style;
                    sizePredicate = sizePredicate.Or(s => s.TLREP_Size_FK == temp.SI_id);
                }

                PPS = PPS.AsExpandable().Where(sizePredicate);
            }

            return(PPS);
        }
Example #4
0
        private void PlanningKnitStock_Load(object sender, EventArgs e)
        {
            FormLoaded = false;

            QueryParms = new ProdQueryParameters();

            using (var context = new TTI2Entities())
            {
                var Dept = context.TLADM_Departments.Where(x => x.Dep_ShortCode.Contains("KNIT")).FirstOrDefault();
                if (Dept != null)
                {
                    var ExistingGreige = context.TLADM_Griege.OrderBy(x => x.TLGreige_Description).ToList();
                    foreach (var record in ExistingGreige)
                    {
                        cmboGreige.Items.Add(new ProductionPlanning.CheckComboBoxItem(record.TLGreige_Id, record.TLGreige_Description, false));
                    }


                    var ExistQuality = context.TLADM_GreigeQuality.ToList();
                    foreach (var record in ExistQuality)
                    {
                        cmboGreigeQuality.Items.Add(new ProductionPlanning.CheckComboBoxItem(record.GQ_Pk, record.GQ_Description, false));
                    }


                    var ExistWeight = context.TLADM_FabricWeight.ToList();
                    foreach (var Record in ExistWeight)
                    {
                        cmboFabWeight.Items.Add(new ProductionPlanning.CheckComboBoxItem(Record.FWW_Id, Record.FWW_Description, false));
                    }

                    var ExistWidth = context.TLADM_FabWidth.ToList();
                    foreach (var record in ExistWidth)
                    {
                        cmboFabWidth.Items.Add(new ProductionPlanning.CheckComboBoxItem(record.FW_Id, record.FW_Description, false));
                    }

                    var ExistWhse = context.TLADM_WhseStore.Where(x => x.WhStore_WhseOrStore).ToList();
                    foreach (var record in ExistWhse)
                    {
                        cmboStore.Items.Add(new ProductionPlanning.CheckComboBoxItem(record.WhStore_Id, record.WhStore_Description, false));
                    }
                }


                FormLoaded = true;
            }
        }
Example #5
0
        public IQueryable <TLCSV_PurchaseOrder> PPSCustomers(ProdQueryParameters parameters)
        {
            var PO = _context.TLCSV_PurchaseOrder.Where(x => !x.TLCSVPO_Closeed).AsQueryable();

            if (parameters.Customers.Count() != 0)
            {
                var CustomerPredicate = PredicateBuilder.False <TLCSV_PurchaseOrder>();
                foreach (var Customer in parameters.Customers)
                {
                    var temp = Customer;
                    CustomerPredicate = CustomerPredicate.Or(s => s.TLCSVPO_Customer_FK == temp.Cust_Pk);
                }
                PO = PO.AsExpandable().Where(CustomerPredicate);
            }
            return(PO);
        }
Example #6
0
        public IQueryable <TLCSV_StockOnHand> PPSSales(ProdQueryParameters parameters)
        {
            var SOH = (from soh in _context.TLCSV_StockOnHand
                       join szs in _context.TLADM_Sizes on soh.TLSOH_Size_FK equals szs.SI_id
                       where soh.TLSOH_Sold && !soh.TLSOH_Returned && soh.TLSOH_SoldDate >= parameters.FromDate && soh.TLSOH_SoldDate <= parameters.ToDate
                       orderby szs.SI_DisplayOrder
                       select soh).AsQueryable();

            /*
             * if (parameters.Styles.Count() != 0)
             * {
             *  var StylePredicate = PredicateBuilder.False<TLCSV_StockOnHand>();
             *  foreach (var Style in parameters.Styles)
             *  {
             *      var temp = Style;
             *      StylePredicate = StylePredicate.Or(s => s.TLSOH_Style_FK == temp.Sty_Id);
             *  }
             *  SOH = SOH.AsExpandable().Where(StylePredicate);
             * }
             *
             *
             * if (parameters.Colours.Count() != 0)
             * {
             *  var ColourPredicate = PredicateBuilder.False<TLCSV_StockOnHand>();
             *  foreach (var Colour in parameters.Colours)
             *  {
             *      var temp = Colour;
             *      ColourPredicate = ColourPredicate.Or(s => s.TYLSOH_Colour_FK == temp.Col_Id);
             *  }
             *  SOH = SOH.AsExpandable().Where(ColourPredicate);
             * }
             *
             * if (parameters.Sizes.Count() != 0)
             * {
             *  var SizePredicate = PredicateBuilder.False<TLCSV_StockOnHand>();
             *  foreach (var Size in parameters.Sizes)
             *  {
             *      var temp = Size;
             *      SizePredicate = SizePredicate.Or(s => s.TLSOH_Size_FK == temp.SI_id);
             *  }
             *  SOH = SOH.AsExpandable().Where(SizePredicate);
             * }
             */


            return(SOH);
        }
Example #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            Button oBth = sender as Button;

            if (oBth != null && formloaded)
            {
                frmPPSViewRep vRep = new frmPPSViewRep(3, QueryParms);
                vRep.ShowDialog();

                QueryParms = new ProdQueryParameters();
                cmboGreige.SelectedIndex        = -1;
                cmboGreigeQuality.SelectedIndex = -1;
                cmboFabWeight.SelectedIndex     = -1;
                cmboFabWidth.SelectedIndex      = -1;
                cmboStore.SelectedIndex         = -1;
            }
        }
Example #8
0
        private void frmSelReorderDetails_Load(object sender, EventArgs e)
        {
            formloaded = false;
            repo       = new PPSRepository();
            parms      = new ProdQueryParameters();

            using (var context = new TTI2Entities())
            {
                var Customers = context.TLADM_CustomerFile.OrderBy(x => x.Cust_Description).ToList();
                foreach (var Customer in Customers)
                {
                    cmboCustomers.Items.Add(new ProductionPlanning.CheckComboBoxItem(Customer.Cust_Pk, Customer.Cust_Description, false));
                }

                var Styles = context.TLADM_Styles.ToList();
                foreach (var Style in Styles)
                {
                    cmboStyles.Items.Add(new ProductionPlanning.CheckComboBoxItem(Style.Sty_Id, Style.Sty_Description, false));
                }

                var Colours = context.TLADM_Colours.OrderBy(x => x.Col_Display).ToList();
                foreach (var Colour in Colours)
                {
                    cmboColours.Items.Add(new ProductionPlanning.CheckComboBoxItem(Colour.Col_Id, Colour.Col_Display, false));
                }

                var Sizes = context.TLADM_Sizes.OrderBy(x => x.SI_DisplayOrder).ToList();
                foreach (var Size in Sizes)
                {
                    cmboSizes.Items.Add(new ProductionPlanning.CheckComboBoxItem(Size.SI_id, Size.SI_Description, false));
                }
            }

            //--------------------------------------------------------
            // wire up the check state changed event
            //--------------------------------------------------------------------------------------------------------
            this.cmboCustomers.CheckStateChanged += new System.EventHandler(this.cmboCustomer_CheckStateChanged);
            this.cmboStyles.CheckStateChanged    += new System.EventHandler(this.cmboStyles_CheckStateChanged);
            this.cmboColours.CheckStateChanged   += new System.EventHandler(this.cmboColours_CheckStateChanged);
            this.cmboSizes.CheckStateChanged     += new System.EventHandler(this.cmboSizes_CheckStateChanged);


            formloaded = true;
        }
Example #9
0
        public IQueryable <TLADM_Griege> GreigeQuery(ProdQueryParameters parameters)
        {
            var GreigeItems = _context.TLADM_Griege.OrderBy(x => x.TLGreige_Description).AsQueryable();

            if (parameters.Greiges.Count > 0)
            {
                var GreigePredicate = PredicateBuilder.False <TLADM_Griege>();
                foreach (var Greige in parameters.Greiges)
                {
                    var temp = Greige;
                    GreigePredicate = GreigePredicate.Or(s => s.TLGreige_Id == temp.TLGreige_Id);
                }

                GreigeItems = GreigeItems.AsExpandable().Where(GreigePredicate);
            }

            if (parameters.GreigeQualities.Count > 0)
            {
                var GreigeQualityPredicate = PredicateBuilder.False <TLADM_Griege>();
                foreach (var Greige in parameters.GreigeQualities)
                {
                    var temp = Greige;
                    GreigeQualityPredicate = GreigeQualityPredicate.Or(s => s.TLGreige_Quality_FK == temp.GQ_Pk);
                }

                GreigeItems = GreigeItems.AsExpandable().Where(GreigeQualityPredicate);
            }

            if (parameters.KnitMachines.Count > 0)
            {
                var KnitMachinePredicate = PredicateBuilder.False <TLADM_Griege>();
                foreach (var Machine in parameters.KnitMachines)
                {
                    var temp = Machine;
                    KnitMachinePredicate = KnitMachinePredicate.Or(s => s.TLGreige_Machine_FK == temp.MD_Pk);
                }

                GreigeItems = GreigeItems.AsExpandable().Where(KnitMachinePredicate);
            }

            return(GreigeItems);
        }
Example #10
0
        public IQueryable <TLPPS_Replenishment> PPSQItemStatus(ProdQueryParameters parameters)
        {
            var IS = _context.TLPPS_Replenishment.AsQueryable();

            if (parameters.Styles.Count() > 0)
            {
                var stylePredicate = PredicateBuilder.False <TLPPS_Replenishment>();
                foreach (var style in parameters.Styles)
                {
                    var temp = style;
                    stylePredicate = stylePredicate.Or(s => s.TLREP_Style_FK == temp.Sty_Id);
                }

                IS = IS.AsExpandable().Where(stylePredicate);
            }

            if (parameters.Colours.Count() > 0)
            {
                var colourPredicate = PredicateBuilder.False <TLPPS_Replenishment>();
                foreach (var style in parameters.Colours)
                {
                    var temp = style;
                    colourPredicate = colourPredicate.Or(s => s.TLREP_Colour_FK == temp.Col_Id);
                }

                IS = IS.AsExpandable().Where(colourPredicate);
            }

            if (parameters.Sizes.Count() > 0)
            {
                var sizePredicate = PredicateBuilder.False <TLPPS_Replenishment>();
                foreach (var style in parameters.Sizes)
                {
                    var temp = style;
                    sizePredicate = sizePredicate.Or(s => s.TLREP_Size_FK == temp.SI_id);
                }

                IS = IS.AsExpandable().Where(sizePredicate);
            }

            return(IS);
        }
Example #11
0
        private void PlanningKnitStock_Load(object sender, EventArgs e)
        {
            formloaded = false;

            QueryParms = new ProdQueryParameters();
            repo       = new PPSRepository();

            using (var context = new TTI2Entities())
            {
                var Dept = context.TLADM_Departments.Where(x => x.Dep_ShortCode.Contains("KNIT")).FirstOrDefault();
                if (Dept != null)
                {
                    cmboGreige.DataSource    = context.TLADM_Griege.ToList();
                    cmboGreige.ValueMember   = "TLGreige_Id";
                    cmboGreige.DisplayMember = "TLGreige_Description";
                    cmboGreige.SelectedIndex = -1;

                    cmboGreigeQuality.DataSource    = context.TLADM_GreigeQuality.ToList();
                    cmboGreigeQuality.ValueMember   = "GQ_Pk";
                    cmboGreigeQuality.DisplayMember = "GQ_Description";
                    cmboGreigeQuality.SelectedIndex = -1;

                    cmboFabWeight.DataSource    = context.TLADM_FabricWeight.ToList();
                    cmboFabWeight.ValueMember   = "FWW_Id";
                    cmboFabWeight.DisplayMember = "FWW_Description";
                    cmboFabWeight.SelectedIndex = -1;

                    cmboFabWidth.DataSource    = context.TLADM_FabWidth.ToList();
                    cmboFabWidth.ValueMember   = "FW_Id";
                    cmboFabWidth.DisplayMember = "FW_description";
                    cmboFabWidth.SelectedIndex = -1;

                    cmboStore.DataSource    = context.TLADM_WhseStore.Where(x => x.WhStore_DepartmentFK == Dept.Dep_Id && !x.WhStore_WhseOrStore).ToList();
                    cmboStore.ValueMember   = "WhStore_Id";
                    cmboStore.DisplayMember = "WhStore_Description";
                    cmboStore.SelectedIndex = -1;
                }

                formloaded = true;
            }
        }