示例#1
0
 private void uc_Exit_SendExitRequest(object sender, uc_Exit.ExitRequestEventArgs e)
 {
     try
     {
         string  result      = string.Empty;
         Boolean exitSuccess = app.LineBLL.SendExitRequest(e.userID, e.password, out result);
         if (exitSuccess)
         {
             //驗證成功
             //System.Windows.Forms.DialogResult dialog = new System.Windows.Forms.DialogResult();
             //dialog = System.Windows.Forms.DialogResult.OK;
             //DialogResult = true;
             CloseFormEvent?.Invoke(this, e);
             TipMessage_Type_Light_woBtn.Show("Succeed", "Exit Successful.", BCAppConstants.INFO_MSG);
             //form.Close();
         }
         else
         {
             TipMessage_Type_Light.Show("Failure", "Exit Failed.", BCAppConstants.INFO_MSG);
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Exception");
     }
 }
示例#2
0
 private void uc_Login_SendLogInRequest(object sender, LogInRequestEventArgs e)
 {
     try
     {
         string result = string.Empty;
         if (app.LineBLL.SendLogInRequest(e.userID, e.password, out result))
         {
             CloseFormEvent?.Invoke(this, e);
             TipMessage_Type_Light_woBtn.Show("", "Login Successful.", BCAppConstants.INFO_MSG);
             app.login(e.userID);
         }
         else
         {
             TipMessage_Type_Light.Show("", "Login Fail.", BCAppConstants.WARN_MSG);
         }
     }
     catch (Exception ex) { logger.Error(ex, "Exception"); }
 }
 private void MSCCommandForceFinish(object sender, MCSCommandForceFinishEventArgs e)
 {
     try
     {
         if (!app.LineBLL.SendMCSCommandForceFinish(e.mcs_cmd, out string result))
         {
             //MessageBox.Show(result);
             TipMessage_Type_Light.Show("", result, BCAppConstants.WARN_MSG);
         }
         else
         {
             TipMessage_Type_Light_woBtn.Show("", "Force Finish Succeed", BCAppConstants.INFO_MSG);
         }
         //app.LineBLL.SendHostModeChange(e.host_mode);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Exception");
     }
 }
示例#4
0
 private void MCSCommandShift(object sender, MCSCommandShiftEventArgs e)
 {
     try
     {
         if (!app.LineBLL.SendMCSCommandShift(e.mcs_cmd, e.vh_id, out string result))
         {
             TipMessage_Type_Light.Show("", result, BCAppConstants.WARN_MSG);
         }
         else
         {
             Adapter.Invoke(new SendOrPostCallback((o1) =>
             {
                 CloseFormEvent?.Invoke(this, e);
             }), null);
             TipMessage_Type_Light_woBtn.Show("", "Shift Command Succeed", BCAppConstants.INFO_MSG);
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Exception");
     }
 }
示例#5
0
 private void uc_PasswordChange_SendPasswordChange(object sender, uc_PasswordChange.PasswordChangeEventArgs e)
 {
     try
     {
         string result = string.Empty;
         if (app.LineBLL.SendPasswordChange(e.userID, e.password_o, e.password_n, e.password_v, out result))
         {
             //變更成功
             TipMessage_Type_Light_woBtn.Show("", "Update Successful.", BCAppConstants.INFO_MSG);
             CloseFormEvent?.Invoke(this, e);
         }
         else
         {
             //變更失敗
             TipMessage_Type_Light.Show("", result, BCAppConstants.WARN_MSG);
             return;
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Exception");
     }
 }
        private async void ButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender.Equals(btn_CancelAbort))
                {
                    var confirmResult = TipMessage_Request_Light.Show("Cancel/Abort the command ?");
                    if (confirmResult != System.Windows.Forms.DialogResult.Yes)
                    {
                        return;
                    }
                    else
                    {
                        TarnferCMDViewObj vmcs_cmd = (TarnferCMDViewObj)grid_MCS_Command.SelectedItem;

                        await Task.Run(() => mSCCommandCancelAbortRequest?.Invoke(this, new MCSCommandCancelAbortEventArgs(vmcs_cmd.CMD_ID.Trim())));

                        //TipMessage_Type_Light.Show("", "Successfully command.", BCAppConstants.INFO_MSG);
                    }
                }
                else if (sender.Equals(btn_Finish))
                {
                    var confirmResult = TipMessage_Request_Light.Show("Force finish the command ?");
                    if (confirmResult != System.Windows.Forms.DialogResult.Yes)
                    {
                        return;
                    }
                    else
                    {
                        TarnferCMDViewObj vmcs_cmd = (TarnferCMDViewObj)grid_MCS_Command.SelectedItem;
                        await Task.Run(() => mSCCommandForceFinishRequest?.Invoke(this, new MCSCommandForceFinishEventArgs(vmcs_cmd.CMD_ID.Trim())));

                        //TipMessage_Type_Light.Show("", "Successfully command.", BCAppConstants.INFO_MSG);
                    }
                }
                else if (sender.Equals(btn_AssignVh))
                {
                    if (grid_MCS_Command.SelectedItem == null)
                    {
                        TipMessage_Type_Light.Show("", "There is no Transfer Command has been selected.", BCAppConstants.WARN_MSG);
                        return;
                    }
                    if (((TarnferCMDViewObj)grid_MCS_Command.SelectedItem).TRANSFERSTATE != E_TRAN_STATUS.Queue)
                    {
                        TipMessage_Type_Light.Show("", "Assign vehicle only for the command which transfer status is queue.", BCAppConstants.WARN_MSG);
                        return;
                    }
                    TarnferCMDViewObj      mcs_cmd       = (TarnferCMDViewObj)grid_MCS_Command.SelectedItem;
                    AssignVehiclePopupForm assignVehicle = new AssignVehiclePopupForm();
                    assignVehicle.readCmdID(mcs_cmd);
                    assignVehicle.ShowDialog();
                }
                else if (sender.Equals(btn_ShiftCmd))
                {
                    if (grid_MCS_Command.SelectedItem == null)
                    {
                        TipMessage_Type_Light.Show("", "There is no Transfer Command has been selected.", BCAppConstants.WARN_MSG);
                        return;
                    }
                    if (((TarnferCMDViewObj)grid_MCS_Command.SelectedItem).TRANSFERSTATE != E_TRAN_STATUS.Initial)
                    {
                        TipMessage_Type_Light.Show("", "Shift command only for the command which transfer status is initial.", BCAppConstants.WARN_MSG);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(((TarnferCMDViewObj)grid_MCS_Command.SelectedItem).VH_ID))
                    {
                        TipMessage_Type_Light.Show("", "Shift command only for the command which already assign vehicle.", BCAppConstants.WARN_MSG);
                        return;
                    }
                    TarnferCMDViewObj     mcs_cmd      = (TarnferCMDViewObj)grid_MCS_Command.SelectedItem;
                    ShiftCommandPopupForm shiftCommand = new ShiftCommandPopupForm();
                    shiftCommand.readCmdID(mcs_cmd);
                    shiftCommand.ShowDialog();
                }
                else if (sender.Equals(btn_ChangeStatus))
                {
                    if (grid_MCS_Command.SelectedItem == null)
                    {
                        TipMessage_Type_Light.Show("", "There is no Transfer Command has been selected.", BCAppConstants.WARN_MSG);
                        return;
                    }
                    TarnferCMDViewObj     mcs_cmd      = (TarnferCMDViewObj)grid_MCS_Command.SelectedItem;
                    ChangeStatusPopupForm changeStatus = new ChangeStatusPopupForm();
                    changeStatus.readCmdID(mcs_cmd);
                    changeStatus.ShowDialog();
                }
                else if (sender.Equals(btn_ChangePriorty))
                {
                    if (grid_MCS_Command.SelectedItem == null)
                    {
                        TipMessage_Type_Light.Show("", "There is no Transfer Command has been selected.", BCAppConstants.WARN_MSG);
                        return;
                    }
                    if (((TarnferCMDViewObj)grid_MCS_Command.SelectedItem).TRANSFERSTATE != E_TRAN_STATUS.Queue)
                    {
                        TipMessage_Type_Light.Show("", "Priority Change only for the command which transfer status is queue.", BCAppConstants.WARN_MSG);
                        return;
                    }
                    //ChangePriorityPopupForm changePriority = new ChangePriorityPopupForm(((TarnferCMDViewObj)grid_MCS_Command.SelectedItem).CMD_ID.Trim());
                    //changePriority.ShowDialog();

                    string mcs_cmd = ((TarnferCMDViewObj)grid_MCS_Command.SelectedItem).CMD_ID.Trim();
                    ChangePriorityPopupForm changePriority = new ChangePriorityPopupForm();
                    changePriority.readCmdID(mcs_cmd);
                    changePriority.ShowDialog();
                }
                else if (sender.Equals(btn_Export))
                {
                    if (CsvUtility.exportLotDataToCSV(app.ObjCacheManager.GetMCS_CMD()))
                    {
                        TipMessage_Type_Light_woBtn.Show("", "Export data completed.", BCAppConstants.INFO_MSG);
                    }
                    else
                    {
                        TipMessage_Type_Light.Show("", "Export data failed.", BCAppConstants.WARN_MSG);
                    }
                }
                else if (sender.Equals(btn_Close))
                {
                    if (TogBtn_McsQUpdate.Toggled1 == false)
                    {
                        await Task.Run(() => mSCCommandAutoAssignChange?.Invoke(this, new MCSCommandAutoAssignUpdateEventArgs(true.ToString())));
                    }
                    CloseFormEvent?.Invoke(this, e);
                }
            }
            catch (Exception ex)
            { logger.Error(ex, "Exception"); }
        }