Beispiel #1
0
        private void PopulateDetails(string equipment)
        {
            txtEquipment      = FindViewById <TextView>(Resource.Id.txtEquipment);
            txtEquipment.Text = equipment;

            txtLot      = FindViewById <TextView>(Resource.Id.txtLot);
            txtLot.Text = "1610950DDAA";

            txtProductName      = FindViewById <TextView>(Resource.Id.txtProductName);
            txtProductName.Text = "1770TKC-000";

            txtTotalQuantity      = FindViewById <TextView>(Resource.Id.txtTotalQuantity);
            txtTotalQuantity.Text = "5000";

            txtRecipe      = FindViewById <TextView>(Resource.Id.txtRecipe);
            txtRecipe.Text = "P9179TSL-TSL8038";

            txtPkgGroup      = FindViewById <TextView>(Resource.Id.txtPkgGroup);
            txtPkgGroup.Text = "K-Matrix";

            txtProductLine      = FindViewById <TextView>(Resource.Id.txtProductLine);
            txtProductLine.Text = "TKC";

            txtPkgDev      = FindViewById <TextView>(Resource.Id.txtPkgDev);
            txtPkgDev.Text = "1770TKC";

            txtSpecsName      = FindViewById <TextView>(Resource.Id.txtSpecsName);
            txtSpecsName.Text = "2200 BELLY BRAND / RECODE";

            txtInProgressQuantity      = FindViewById <TextView>(Resource.Id.txtInProgressQuantity);
            txtInProgressQuantity.Text = "5000";

            txtInProgressPercentage      = FindViewById <TextView>(Resource.Id.txtInProgressPercentage);
            txtInProgressPercentage.Text = "100%";

            txtYieldPercentage      = FindViewById <TextView>(Resource.Id.txtYieldPercentage);
            txtYieldPercentage.Text = "N / A";

            linearPie = FindViewById <LinearLayout>(Resource.Id.linearLayoutPieHolder);

            View vwOEE = Doughnut.OEE(this, 100, 0, UIControl.GetColorCodeStatus("IDLE"), UIControl.GetColorCodePie());

            linearPie.AddView(vwOEE);
        }
Beispiel #2
0
        private void createOnline(LinearLayout LinearParent, string equipment, string LotNo, bool isVisible)
        {
            LinearLayout linearDetails = new LinearLayout(this);

            linearDetails.Orientation = Orientation.Vertical;

            if (isVisible == true)
            {
                linearDetails.Visibility = ViewStates.Visible;
            }
            else
            {
                linearDetails.Visibility = ViewStates.Gone;
            }

            UIControl.AddControl(this, linearDetails, "linearOnline_" + equipment);

            linearDetails.LayoutParameters =
                new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
            {
                LeftMargin   = Common.convertDPtoPixel(5),
                BottomMargin = Common.convertDPtoPixel(5),
                Weight       = Common.convertDPtoPixel(100)
            };

            LinearParent.AddView(linearDetails);

            TextView txtLot = new TextView(this);

            txtLot.Text = LotNo;
            txtLot.SetTextAppearance(this, Android.Resource.Style.TextAppearanceMedium);
            txtLot.SetTypeface(null, TypefaceStyle.Bold);
            txtLot.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));

            UIControl.AddControl(this, txtLot, "txtLotOnline_" + equipment);

            txtLot.LayoutParameters =
                new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            {
                LeftMargin = Common.convertDPtoPixel(5),
                TopMargin  = Common.convertDPtoPixel(5),
                Weight     = Common.convertDPtoPixel(10)
            };

            linearDetails.AddView(txtLot);

            RelativeLayout relLayout = new RelativeLayout(this);

            relLayout.SetMinimumHeight(Common.convertDPtoPixel(25));
            relLayout.SetMinimumWidth(Common.convertDPtoPixel(25));

            relLayout.LayoutParameters =
                new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, Common.convertDPtoPixel(170))
            {
                Weight    = Common.convertDPtoPixel(60),
                TopMargin = Common.convertDPtoPixel(5)
            };

            linearDetails.AddView(relLayout);

            LinearLayout linearPie = new LinearLayout(this);

            linearPie.Orientation = Orientation.Vertical;

            linearPie.SetMinimumHeight(Common.convertDPtoPixel(25));
            linearPie.SetMinimumWidth(Common.convertDPtoPixel(25));

            linearPie.LayoutParameters =
                new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, Common.convertDPtoPixel(138))
            {
                TopMargin = Common.convertDPtoPixel(23)
            };

            relLayout.AddView(linearPie);

            var pie = Doughnut.OEE(this, 100, 0, UIControl.GetColorCodeStatus("ONLINE"), UIControl.GetColorCodePie());

            linearPie.AddView(pie);

            ImageView imgView = new ImageView(this);

            imgView.LayoutParameters =
                new RelativeLayout.LayoutParams(Common.convertDPtoPixel(125), Common.convertDPtoPixel(125))
            {
                TopMargin  = Common.convertDPtoPixel(30),
                LeftMargin = Common.convertDPtoPixel(98)
            };

            imgView.SetBackgroundResource(Resource.Drawable.oval);
            relLayout.AddView(imgView);

            TextView txt100 = new TextView(this);

            txt100.SetTextAppearance(this, Android.Resource.Style.TextAppearanceSmall);
            txt100.Text = "100";
            txt100.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));

            var param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            {
                TopMargin = Common.convertDPtoPixel(3)
            };

            txt100.LayoutParameters = param;
            txt100.Gravity          = GravityFlags.Center;

            relLayout.AddView(txt100);

            TextView txt50 = new TextView(this);

            txt50.SetTextAppearance(this, Android.Resource.Style.TextAppearanceSmall);
            txt50.Text = "50";
            txt50.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));

            param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            {
                TopMargin = Common.convertDPtoPixel(161)
            };

            txt50.LayoutParameters = param;
            txt50.Gravity          = GravityFlags.Center;

            relLayout.AddView(txt50);

            TextView txt75 = new TextView(this);

            txt75.SetTextAppearance(this, Android.Resource.Style.TextAppearanceSmall);
            txt75.Text = "75";
            txt75.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));

            param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            {
                TopMargin   = Common.convertDPtoPixel(81),
                RightMargin = Common.convertDPtoPixel(160)
            };

            txt75.LayoutParameters = param;
            txt75.Gravity          = GravityFlags.Center;

            txt75.Rotation = 270;

            relLayout.AddView(txt75);

            TextView txt25 = new TextView(this);

            txt25.SetTextAppearance(this, Android.Resource.Style.TextAppearanceSmall);
            txt25.Text = "25";
            txt25.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));

            param = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            {
                TopMargin  = Common.convertDPtoPixel(81),
                LeftMargin = Common.convertDPtoPixel(160)
            };

            txt25.LayoutParameters = param;
            txt25.Gravity          = GravityFlags.Center;

            txt25.Rotation = 90;

            relLayout.AddView(txt25);

            TextView txtYieldTitle = new TextView(this);

            txtYieldTitle.SetTextAppearance(this, Android.Resource.Style.TextAppearanceMedium);
            txtYieldTitle.Text = "Yield";
            txtYieldTitle.SetTextColor(Color.ParseColor(UIControl.GetColorCodeStatus("ONLINE")));
            txtYieldTitle.SetTypeface(null, TypefaceStyle.Bold);
            txtYieldTitle.SetTextSize(Android.Util.ComplexUnitType.Sp, 15);

            param = new RelativeLayout.LayoutParams(Common.convertDPtoPixel(100), ViewGroup.LayoutParams.WrapContent)
            {
                TopMargin  = Common.convertDPtoPixel(65),
                LeftMargin = Common.convertDPtoPixel(111)
            };

            txtYieldTitle.LayoutParameters = param;
            txtYieldTitle.Gravity          = GravityFlags.Center;

            relLayout.AddView(txtYieldTitle);

            TextView txtYield = new TextView(this);

            txtYield.SetTextAppearance(this, Android.Resource.Style.TextAppearanceMedium);
            txtYield.Text = "100%";
            txtYield.SetTypeface(null, TypefaceStyle.Bold);
            txtYield.SetTextSize(Android.Util.ComplexUnitType.Dip, 20);
            txtYield.SetTextColor(Color.ParseColor(UIControl.GetColorCodeStatus("ONLINE")));

            UIControl.AddControl(this, txtYield, "txtYieldOnline_" + equipment);

            param = new RelativeLayout.LayoutParams(Common.convertDPtoPixel(100), ViewGroup.LayoutParams.WrapContent)
            {
                LeftMargin = Common.convertDPtoPixel(111),
                TopMargin  = Common.convertDPtoPixel(82)
            };

            txtYield.LayoutParameters = param;
            txtYield.Gravity          = GravityFlags.Center;

            relLayout.AddView(txtYield);

            Button btn = new Button(this);

            btn.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));
            btn.SetTypeface(null, TypefaceStyle.Bold);
            btn.SetTextSize(Android.Util.ComplexUnitType.Sp, 25);

            btn.LayoutParameters =
                new RelativeLayout.LayoutParams(70, 70)
            {
                LeftMargin = Common.convertDPtoPixel(245)
            };

            btn.Click += delegate
            {
                GoToAlarmPage(equipment);
            };

            btn.SetBackgroundResource(Resource.Drawable.notification);

            var result     = HttpHandler.GetAlarms(GlobalVariable.userID, equipment);
            int alarmCount = 0;

            try
            {
                alarmCount = result.Count;
            }
            catch
            {
                alarmCount = 0;
            }

            if (alarmCount > 999)
            {
                btn.Text = "999+";
            }
            else
            {
                btn.Text = alarmCount.ToString();
            }

            if (alarmCount == 0)
            {
                btn.Visibility = ViewStates.Gone;
            }
            else
            {
                btn.Visibility = ViewStates.Visible;
            }

            UIControl.AddControl(this, btn, "btnAlarmOnline_" + equipment);

            relLayout.AddView(btn);

            //In Progress
            LinearLayout linearInProgress = new LinearLayout(this);

            linearInProgress.Orientation = Orientation.Horizontal;
            linearInProgress.SetGravity(GravityFlags.Center);

            linearInProgress.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            {
                TopMargin = Common.convertDPtoPixel(185)
            };

            relLayout.AddView(linearInProgress);

            TextView txtInProgressTitle = new TextView(this);

            txtInProgressTitle.SetTextAppearance(this, Android.Resource.Style.TextAppearanceMedium);
            txtInProgressTitle.Text = "In Progress: ";
            txtInProgressTitle.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));
            txtInProgressTitle.SetTypeface(null, TypefaceStyle.Bold);

            txtInProgressTitle.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
            {
            };

            linearInProgress.AddView(txtInProgressTitle);

            TextView txtInProgressCurrent = new TextView(this);

            txtInProgressCurrent.SetTextAppearance(this, Android.Resource.Style.TextAppearanceMedium);
            txtInProgressCurrent.Text = "5000";
            txtInProgressCurrent.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));
            txtInProgressCurrent.SetTypeface(null, TypefaceStyle.Bold);

            txtInProgressCurrent.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
            {
            };

            UIControl.AddControl(this, txtInProgressCurrent, "txtInProgressCurrentOnline_" + equipment);

            linearInProgress.AddView(txtInProgressCurrent);

            TextView txtSlash = new TextView(this);

            txtSlash.SetTextAppearance(this, Android.Resource.Style.TextAppearanceMedium);
            txtSlash.Text = " / ";
            txtSlash.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));
            txtSlash.SetTypeface(null, TypefaceStyle.Bold);

            txtSlash.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
            {
            };

            linearInProgress.AddView(txtSlash);

            TextView txtInProgressTotal = new TextView(this);

            txtInProgressTotal.SetTextAppearance(this, Android.Resource.Style.TextAppearanceMedium);
            txtInProgressTotal.Text = "5000";
            txtInProgressTotal.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));
            txtInProgressTotal.SetTypeface(null, TypefaceStyle.Bold);

            UIControl.AddControl(this, txtInProgressTotal, "txtInProgressTotalOnline_" + equipment);

            txtInProgressTotal.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
            {
            };

            linearInProgress.AddView(txtInProgressTotal);

            TextView txtFiller = new TextView(this);

            txtFiller.SetTextAppearance(this, Android.Resource.Style.TextAppearanceMedium);
            txtFiller.Text = " [ ";
            txtFiller.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));
            txtFiller.SetTypeface(null, TypefaceStyle.Bold);

            txtFiller.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
            {
            };

            linearInProgress.AddView(txtFiller);

            TextView txtPercentage = new TextView(this);

            txtPercentage.SetTextAppearance(this, Android.Resource.Style.TextAppearanceMedium);
            txtPercentage.Text = "100%";
            txtPercentage.SetTextColor(Color.ParseColor(UIControl.GetColorCodeStatus("ONLINE")));
            txtPercentage.SetTypeface(null, TypefaceStyle.Bold);

            UIControl.AddControl(this, txtPercentage, "txtPercentageOnline_" + equipment);

            txtPercentage.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
            {
            };

            linearInProgress.AddView(txtPercentage);

            TextView txtFiller2 = new TextView(this);

            txtFiller2.SetTextAppearance(this, Android.Resource.Style.TextAppearanceMedium);
            txtFiller2.Text = " ]";
            txtFiller2.SetTextColor(Color.ParseColor(UIControl.GetColorCodePie()));
            txtFiller2.SetTypeface(null, TypefaceStyle.Bold);

            txtFiller2.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
            {
            };

            linearInProgress.AddView(txtFiller2);
        }