Esempio n. 1
0
        private void LoadDailySchedule()
        {
            if (DateLock == false)
            {
                var regDate = DateTime.Now;
                DateStamp = regDate.ToString("MM/dd/yyyy");
            }

            UnRegisterRows();

           SQLcontrol.RunQuery("SELECT TOP 26 * FROM DS_SCHEDULE WHERE CONVERT(varchar, SCHEDULE_TIME, 101) = '" + DateStamp + "' AND (OUT_TIME IS NULL AND CANCELLED_TIME IS NULL) AND LOCATION = '" + Location + "' ORDER BY SCHEDULE_TIME ASC");
            //SQLcontrol.RunQuery("SELECT TOP 26 * FROM DS_SCHEDULE WHERE CONVERT(varchar, SCHEDULE_TIME, 101) = '09/30/2018' AND (OUT_TIME IS NULL AND CANCELLED_TIME IS NULL) AND LOCATION = '" + Location + "' ORDER BY SCHEDULE_TIME ASC");

            RowsLoaded = SQLcontrol.RecordCount;

            if (SQLcontrol.RecordCount > 0)
            {
                DateLock = true;

                for (RowNum = 0; RowNum < SQLcontrol.RecordCount; RowNum++)
                {
                    CreateNewRow();
                    LblConnectionError.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                DateLock = false;
                RowsLoaded = 0;
                LblConnectionError.Visibility = Visibility.Visible;
            }
        }
        //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        //''''''''''''''''''''''''''''''''''''                LOGS               ''''''''''''''''''''''''''''''''''''
        //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        private static void LogError(string custom, string message, string stackTrace, string source, string targetSite)
        {
            var dateTime = DateTime.Now.ToString();
            var version  = Assembly.GetExecutingAssembly().GetName().Version.ToString();

            SQLcontrol.InsertLog(dateTime, Environment.MachineName, version, "MS", custom, message, stackTrace, source, targetSite);
        }
Esempio n. 3
0
        public DockScheduleDisplay()
        {
            InitializeComponent();

            //Populates About Panel
            LblAboutVersion.Content = Viewport.GlobalInformation.appVersion;
            LblAboutLocation.Content = Viewport.GlobalInformation.appLocation;
            LblAboutName.Content = Viewport.GlobalInformation.appName;

            GridLayoutTemplate.Visibility = Visibility.Collapsed;

            if (SQLcontrol.HasConnection())
            {
                GrdSQLnotification.Visibility = Visibility.Collapsed;

                DateLock = false;

                SetScheduleLocation();
                LoadDailySchedule();
                CalculateAverage();

                LocalClock();
                StartUpdateTimer();
            }
            else
            {
                GrdSQLnotification.Visibility = Visibility.Visible;
            }
        }
        //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        //''''''''''''''''''''''''''''''''''''           PANEL BUTTONS           ''''''''''''''''''''''''''''''''''''
        //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        private void UpdateAction_Click(object sender, RoutedEventArgs e)
        {
            var Btn    = (Button)sender;
            var rowNum = Regex.Replace(Btn.Name, "[^0-9 _]", "");

            var focusPairID  = FindName("txtPairID" + rowNum.ToString()) as TextBlock;
            var focusActive  = FindName("btnAction" + rowNum.ToString()) as Button;
            var focusDisplay = FindName("lblTime" + rowNum.ToString()) as Label;
            var focusArrive  = FindName("lblValueArrive" + rowNum.ToString()) as Label;
            var focusSent    = FindName("lblValueSent" + rowNum.ToString()) as Label;
            var focusTimeIn  = FindName("lblValueTimeIn" + rowNum.ToString()) as Label;

            var PairId = focusPairID.Text.ToString();

            DateTime now = DateTime.Now;

            if (focusActive.Content.ToString() == "MARK ARRIVED")
            {
                //LATE ARRIVAL HIGHLIGHT-------------------------
                SQLcontrol.RunQuery("SELECT * FROM DS_SCHEDULE WHERE ID = '" + PairId + "'");

                var      scheduleTime = SQLcontrol.Ds.Tables[0].Rows[0]["SCHEDULE_TIME"].ToString();
                DateTime displayTime  = DateTime.Parse(scheduleTime, new CultureInfo("en-US", true));

                if (DateTime.Now > displayTime)
                {
                    focusDisplay.Foreground = new SolidColorBrush(Color.FromArgb(255, 241, 81, 87));
                }
                //-----------------------------------------------

                focusActive.Content    = "SENT TO DOCK";
                focusActive.Background = new SolidColorBrush(Color.FromArgb(255, 247, 152, 28));
                focusArrive.Content    = now.ToShortTimeString();

                SQLcontrol.InsertTime("ARRIVAL_TIME", PairId);
            }
            else if (focusActive.Content.ToString() == "SENT TO DOCK")
            {
                focusActive.Content    = "ARRIVED AT DOCK";
                focusActive.Background = new SolidColorBrush(Color.FromArgb(255, 127, 91, 230));
                focusSent.Content      = now.ToShortTimeString();

                SQLcontrol.InsertTime("SENT_TIME", PairId);
            }
            else if (focusActive.Content.ToString() == "ARRIVED AT DOCK")
            {
                focusActive.Content    = "DEPARTED DOCK";
                focusActive.Background = new SolidColorBrush(Color.FromArgb(255, 25, 145, 235));
                focusTimeIn.Content    = now.ToShortTimeString();

                SQLcontrol.InsertTime("IN_TIME", PairId);
            }
            else if (focusActive.Content.ToString() == "DEPARTED DOCK")
            {
                SQLcontrol.InsertTime("OUT_TIME", PairId);
                LoadDailySchedule();
            }
        }
Esempio n. 5
0
        private void SetScheduleLocation()
        {
            SQLcontrol.RunQuery("SELECT * FROM [@profiles] WHERE COMPUTER = '" + Environment.MachineName + "'");

            if (SQLcontrol.RecordCount > 0)
            {
                Location = SQLcontrol.Ds.Tables[0].Rows[0]["LOCATION"].ToString();
            }
        }
        private void NoShowCategory_Click(object sender, RoutedEventArgs e)
        {
            var btn    = (Button)sender;
            var code   = Regex.Replace(btn.Name, "[^0-9 _]", "");
            var pairId = CancelDisplayPairId.Content.ToString(); //TODO

            SQLcontrol.InsertCancel(pairId, code);
            LoadDailySchedule();
            CancelDialogPanel.Visibility     = Visibility.Collapsed;
            OverlayViewportDimmer.Visibility = Visibility.Collapsed;
        }
Esempio n. 7
0
        private void UpdateConfig(string appName)
        {
            SQLcontrol.RunQuery("SELECT * FROM [@profiles] WHERE COMPUTER ='" + Environment.MachineName + "'");

            if (SQLcontrol.RecordCount > 0)
            {
                LblAboutLocation.Content = SQLcontrol.Ds.Tables[0].Rows[0]["LOCATION"].ToString();
                LoadApplication(appName);
            }
            else
            {
                var nameArray = Environment.MachineName.Split('-');
                if (nameArray.Length > 0)
                {
                    _parse1 = nameArray[0];
                }
                if (nameArray.Length > 1)
                {
                    _parse2 = nameArray[1];
                }
                if (nameArray.Length > 2)
                {
                    _parse3 = nameArray[2];
                }

                switch (_parse1)
                {
                case "DSCENTER":
                    GlobalInformation.appLocation = "Distribution Center";
                    break;

                case "SUNDOLPH":
                    GlobalInformation.appLocation = "Sundolphin";
                    break;

                case "EXTRUSION":
                    GlobalInformation.appLocation = "Extrusion";
                    break;

                case "FIVEPEAKS":
                    GlobalInformation.appLocation = "Five Peaks";
                    break;

                case "STCKBRDG":
                    GlobalInformation.appLocation = "Stockbridge";
                    break;
                }

                SQLcontrol.InsertComputer(Environment.MachineName, GlobalInformation.appLocation, _parse2, _parse3, appName, LblAboutVersion.Content.ToString());
                LblAboutLocation.Content = GlobalInformation.appLocation;

                LoadApplication(appName);
            }
        }
        private void workerLoadHeader_DoWork(object sender, DoWorkEventArgs e)
        {
            RefreshReady = false;
            SQLcontrol.RunQuery("SELECT * FROM APP_MO_SCHEDULE WHERE MACHINE = '" + MachineNumber + "'");

            if (SQLcontrol.RecordCount <= 0)
            {
                return;
            }

            var sqlPart = SQLcontrol.Ds.Tables[0].Rows[0]["PART"].ToString();

            DetectFileStatus(sqlPart);
        }
        private void DockLocationArray(string location)
        {
            SQLcontrol.RunQuery_application("SELECT * FROM DS_CAT_LOCATIONS WHERE LOCATION = '" + location + "'");

            if (SQLcontrol.RecordCount > 0)
            {
                int dockMax = Convert.ToInt32(SQLcontrol.Ds.Tables[0].Rows[0]["DOCK"]);

                AddDockToList.Clear();

                for (int i = 1; i <= dockMax; i++)
                {
                    AddDockToList.Add(i.ToString());
                }
            }
        }
Esempio n. 10
0
        private void Refresh_machineData(bool manualRefresh)
        {
            if (!RefreshReady)
            {
                return;
            }

            SQLcontrol.RunQuery("SELECT * FROM APP_MO_SCHEDULE WHERE MACHINE = '" + MachineNumber + "'");

            if (SQLcontrol.RecordCount > 0)
            {
                var sqlPart        = SQLcontrol.Ds.Tables[0].Rows[0]["PART"].ToString();
                var sqlDescription = SQLcontrol.Ds.Tables[0].Rows[0]["DESCRIPTION"].ToString();
                var sqlQuantity    = SQLcontrol.Ds.Tables[0].Rows[0]["QUANTITY"].ToString();

                if (MachineQuantity != sqlQuantity)
                {
                    TitlePartInformation.Content = sqlPart + " : " + sqlDescription + " (x" + sqlQuantity + ")";
                }
                if (MachinePart != sqlPart)
                {
                    ClearErrorNotifications();
                    ResetSidebar();
                    CollapseAllViewers();
                    LoadHeaderInformation();
                }
                else
                {
                    if (!manualRefresh)
                    {
                        return;
                    }
                    CollapseAllViewers();
                    ResetSidebar();
                    LoadHeaderInformation();
                    UpdateTempFiles();
                    StandardizeWork_run();
                }
            }
            else
            {
                //Machine Not in View
                ErrorCode_xMS001();
            }
        }
Esempio n. 11
0
        private string Get_BoMsUrl(string part, string location)
        {
            if (File.Exists(location))
            {
                SQLcontrol.RunQuery("EXEC Bill_of_Materials '" + part + "'");

                if (SQLcontrol.RecordCount > 0)
                {
                    var fileUrl = CreateTempFile(location, ".rpt");
                    return(fileUrl);
                }

                ErrorCode_xMS202(location);     //BOM Empty
                return(null);
            }

            ErrorCode_xMS201();                 //BOM Missing
            return(null);
        }
Esempio n. 12
0
        private void LoadHeaderInformation()
        {
            SQLcontrol.RunQuery("SELECT * FROM APP_MO_SCHEDULE WHERE MACHINE = '" + MachineNumber + "'");

            if (SQLcontrol.RecordCount > 0)
            {
                var sqlPart        = SQLcontrol.Ds.Tables[0].Rows[0]["PART"].ToString();
                var sqlDescription = SQLcontrol.Ds.Tables[0].Rows[0]["DESCRIPTION"].ToString();
                var sqlQuantity    = SQLcontrol.Ds.Tables[0].Rows[0]["QUANTITY"].ToString();

                if (sqlPart != "")
                {
                    TitlePartInformation.Content = sqlPart + " : " + sqlDescription + " (x" + sqlQuantity + ")";
                    ClearErrorNotifications();

                    MachinePart     = sqlPart;
                    MachineQuantity = sqlQuantity;

                    //Begins search for file existence
                    _workerLoadHeader.RunWorkerAsync();
                    _workerLoadForms.RunWorkerAsync();
                }
                else
                {
                    ResetUrls();

                    if (sqlPart != "")
                    {
                        return;
                    }
                    TitlePartInformation.Content = "NOTHING SCHEDULED";
                    ClearErrorNotifications();
                    CollapseAllViewers();
                }
            }
            else
            {
                //cant find machine in view
                ErrorCode_xMS001();
                ClearErrorNotifications();
                CollapseAllViewers();
            }
        }
Esempio n. 13
0
        private void UpdateDock_Selected(object sender, SelectionChangedEventArgs e)
        {
            var Cmb = (ComboBox)sender;
            var Row = Regex.Replace(Cmb.Name, "[^0-9 _]", "");

            var FocusDock   = FindName("cmbValueDock" + Row.ToString()) as ComboBox;
            var FocusPairId = FindName("txtPairID" + Row.ToString()) as TextBlock;

            if (FocusDock.SelectedIndex > 0)
            {
                var dockNum = FocusDock.SelectedValue.ToString();
                var pairID  = FocusPairId.Text.ToString();
                SQLcontrol.InsertDockNumber(dockNum, pairID);
            }
            else
            {
                var pairID = FocusPairId.Text.ToString();
                SQLcontrol.ClearDockNumber(pairID);
            }
        }
Esempio n. 14
0
        //''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        //'''''''''''''''''''''''''''''''''''           SQL SEQUENCES           ''''''''''''''''''''''''''''''''''''
        //''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        private void CalculateAverage()
        {
            var baseDate = DateTime.Now;
            var fwd = baseDate.AddDays(-(int)baseDate.DayOfWeek);
            var lwd = fwd.AddDays(7).AddSeconds(-1);

            FirstWeekday = fwd.ToString("MM/dd/yyyy");
            LastWeekDay = lwd.ToString("MM/dd/yyyy");

            SQLcontrol.RunQuery("SELECT IN_TIME, OUT_TIME FROM DS_SCHEDULE WHERE SCHEDULE_TIME BETWEEN '" + FirstWeekday + " 00:00:00.00' AND '" + LastWeekDay + " 23:59:59.999' AND LOAD_TIME > '00:05:00' AND LOCATION = '" + Location + "'");


            if (SQLcontrol.RecordCount > 0)
            {
                var span = new DateTime();

                for (var i = 0; i < SQLcontrol.RecordCount; i++)
                {
                    var strInTime = SQLcontrol.Ds.Tables[0].Rows[i]["IN_TIME"].ToString();
                    var strOutTime = SQLcontrol.Ds.Tables[0].Rows[i]["OUT_TIME"].ToString();

                    var inTime = DateTime.Parse(strInTime, new CultureInfo("en-US", true));
                    var outTime = DateTime.Parse(strOutTime, new CultureInfo("en-US", true));

                    span += (outTime - inTime);
                }

                var avgSpan = new TimeSpan(span.Ticks / SQLcontrol.RecordCount);

                var tempDt = DateTime.MinValue.Add(avgSpan);
                var displayAverage = tempDt.ToString("H:mm:ss");

                txtAverage.Text = displayAverage;
            }
            else
            {
                txtAverage.Text = "00:00:00";
            }


        }
Esempio n. 15
0
        private void ReadConfig()
        {
            SQLcontrol.RunQuery("SELECT * FROM [@profiles] WHERE COMPUTER ='" + Environment.MachineName + "'");

            if (SQLcontrol.RecordCount > 0)
            {
                GlobalInformation.appLocation = SQLcontrol.Ds.Tables[0].Rows[0]["LOCATION"].ToString();
                LblAboutLocation.Content      = GlobalInformation.appLocation;

                LoadApplication(SQLcontrol.Ds.Tables[0].Rows[0]["APPLICATION"].ToString());


                //checks for recorded version number -------
                if (LblAboutVersion.Content.ToString() == SQLcontrol.Ds.Tables[0].Rows[0]["Version"].ToString())
                {
                    return;
                }

                //updates new version number -----------
                SQLcontrol.UpdateComputer(LblAboutVersion.Content.ToString(), SQLcontrol.Ds.Tables[0].Rows[0]["ID"].ToString());
            }
        }
Esempio n. 16
0
        public MachineOperations()
        {
            InitializeComponent();

            //Populates About Panel
            LblAboutVersion.Content  = Viewport.GlobalInformation.appVersion;
            LblAboutLocation.Content = Viewport.GlobalInformation.appLocation;
            LblAboutName.Content     = Viewport.GlobalInformation.appName;

            LocalClock();
            DeclareWorkers();
            DeleteObsoleteTempFiles();

            PdfCommon.Initialize("52433553494d50032923be84e16cd6ae0bce153446af7918d52303038286fd2b3b152577b1db687a1fddd5421ba5de0de33485546791f523f09d6a386e859c9f977b1ae8ff459708090f0552a3505549f9bd4f984adcb484ce3b75bb4f3c1fcd6f97b68c22cb7ecfd52fc40c9ea0a748d251457b07b7fcb3e84e4641176b807b");

            PdfViewer.Visibility     = Visibility.Collapsed;
            CrystalViewer.Visibility = Visibility.Collapsed;

            if (SQLcontrol.HasConnection())
            {
                SQLcontrol.RunQuery("SELECT * FROM [@profiles] WHERE COMPUTER = '" + Environment.MachineName + '"');

                if (SQLcontrol.RecordCount > 0)
                {
                    MachineNumber = SQLcontrol.Ds.Tables[0].Rows[0]["NUMBER"].ToString();
                    //TODO MACHINE NUMBER SOMEWHERE
                }

                GrdSqlNotification.Visibility = Visibility.Collapsed;

                LoadHeaderInformation();
            }
            else
            {
                GrdSqlNotification.Visibility = Visibility.Visible;
            }
        }
Esempio n. 17
0
 private static string Get_FileUrl(string part, string container)
 {
     SQLcontrol.RunQuery("SELECT * FROM MO_FILE_LISTING WHERE PART = '" + part + "' AND CONTAINER = '" + container + "'");
     return(SQLcontrol.RecordCount > 0 ? SQLcontrol.Ds.Tables[0].Rows[0]["MASTER"].ToString() : null);
 }