예제 #1
0
 private void txtMacAddress_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtMacAddress.Text))
         {
             SetErrorStatus(true, "NG", "Mac Address không được để trống!");
             Ultils.EditTextErrorNoMessage(txtMacAddress);
         }
         else
         {
             if (txtMacAddress.Text.Length <= 2)
             {
                 SetErrorStatus(true, "NG", "Mac Address Error!\nKhông đúng định dạng.\nVui lòng thử lại!");
                 txtMacAddress.SelectAll();
                 Ultils.EditTextErrorNoMessage(txtMacAddress);
             }
             else
             {
                 txtJudge.Focus();
                 SetErrorStatus(false, null, null);
             }
         }
     }
 }
예제 #2
0
 private void txtBoxID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtBoxID.Text))
         {
             SetErrorStatus(true, "NG", "Box ID không được để trống!");
             Ultils.EditTextErrorNoMessage(txtBoxID);
         }
         else
         {
             string strBoxId = txtBoxID.Text;
             if (strBoxId.Length >= 3)
             {
                 if (strBoxId.Substring(0, 3).ToUpper() != "F00")
                 {
                     SetErrorStatus(true, "NG", "BOX ID phải bắt đầu bằng F00!");
                     Ultils.EditTextErrorNoMessage(txtBoxID);
                     txtBoxID.SelectAll();
                 }
                 else
                 {
                     SetErrorStatus(false, null, null);
                     InsertLog(txtBoxID.Text.Trim());
                 }
             }
             else
             {
                 SetErrorStatus(true, "NG", "BOX ID không đúng định đạng!");
                 Ultils.EditTextErrorNoMessage(txtBoxID);
             }
         }
     }
 }
예제 #3
0
 private void txtOperationID_Validating(object sender, CancelEventArgs e)
 {
     if (!string.IsNullOrEmpty(txtOperationID.Text))
     {
         int value = 0;
         if (!int.TryParse(txtOperationID.Text, out value))
         {
             dxErrorProvider1.SetError(txtOperationID, "Error! Line value faild.");
             Ultils.EditTextErrorNoMessage(txtOperationID);
         }
         else
         {
             if (value > 3)
             {
                 dxErrorProvider1.SetError(txtOperationID, "Error! Operation value faild.");
                 Ultils.EditTextErrorNoMessage(txtOperationID);
             }
             else
             {
                 btnLogin.Focus();
                 btnLogin.PerformClick();
             }
         }
     }
 }
예제 #4
0
 private void txtJudge_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtJudge.Text))
         {
             SetErrorStatus(true, "NG", "Judge không được để trống!");
             Ultils.EditTextErrorNoMessage(txtJudge);
         }
         else
         {
             if (txtJudge.Text.Trim() == "1" || txtJudge.Text.Trim() == "0")
             {
                 SetErrorStatus(false, null, null);
                 InsertLog(txtBoxID.Text);
             }
             else
             {
                 SetErrorStatus(true, "NG", "Judge Error!\nKhông đúng định dạng.\nVui lòng thử lại!\nChỉ chấp nhận giá trị: 1 hoặc 0 ");
                 txtJudge.SelectAll();
                 Ultils.EditTextErrorNoMessage(txtJudge);
             }
         }
     }
     if (e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtJudge.Text))
         {
             SetErrorStatus(true, "NG", "Judge không được để trống!");
             Ultils.EditTextErrorNoMessage(txtJudge);
         }
     }
 }
예제 #5
0
파일: FormMurata.cs 프로젝트: imatary/work
        private void txtModelUMC_EditValueChanged(object sender, EventArgs e)
        {
            Ultils.SetColorDefaultTextControl(txtModelUMC);
            string modelName = txtModelUMC.EditValue.ToString();

            if (!string.IsNullOrEmpty(modelName))
            {
                var model = _modelService.GetModelById(modelName);
                if (model != null)
                {
                    lblQuantityModel.Visible      = true;
                    lblQuantityModel.Text         = $"/{model.Quantity}";
                    tableLayoutPanelModel.Visible = true;
                    lblCurentModel.Text           = model.ModelName;
                    lblSerialNo.Text     = model.SerialNo;
                    lblCustomerName.Text = $"Barcode {model.CustomerName}";
                    modelID = model.ModelID;

                    checkModelCUS.Text = $"Check width Label Murata - {model.CodeMurata}";

                    modelName = model.ModelName.Trim();
                    serialNo  = model.SerialNo.Trim();
                    if (model.CheckWidthModelCus == true)
                    {
                        codeMurata = model.CodeMurata.Trim();

                        EnbaleCheckWidthModelCus(true);
                        txtBoxID.Enabled     = true;
                        checkPASS.Enabled    = true;
                        checkNG.Enabled      = true;
                        txtProductID.Enabled = true;
                        txtBoxID.Focus();
                    }
                    else
                    {
                        EnbaleCheckWidthModelCus(false);
                        txtBoxID.Enabled     = true;
                        checkPASS.Enabled    = true;
                        checkNG.Enabled      = true;
                        txtProductID.Enabled = true;
                        txtBoxID.Focus();
                    }
                }
                else
                {
                    SetErrorStatus("NG", $"Sai Model. Vui lòng kiểm tra lại!");
                    Ultils.EditTextErrorNoMessage(txtModelCUS);
                }
            }
        }
예제 #6
0
 private void txtProductionID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtProductionID.Text))
         {
             Ultils.TextControlNotNull(txtProductionID, "Production ID");
         }
         else
         {
             foreach (var item in _oqcService.GetModels())
             {
                 if (txtProductionID.Text.Trim().Contains(item.SerialNo) && txtProductionID.Text.Contains(item.ModelID))
                 {
                     lblQuantityModel.Visible      = true;
                     lblQuantityModel.Text         = $"/{item.Quantity}";
                     tableLayoutPanelModel.Visible = true;
                     lblCurentModel.Text           = item.ModelID;
                     lblSerialNo.Text = item.SerialNo;
                     break;
                 }
             }
             var production = _oqcService.GetLogByProductionId(txtProductionID.Text.Trim());
             if (production != null)
             {
                 //SetErrorStatus(true, "NG", $"Error!\nProduction ID[{txtProductionID.Text.Trim()}]\nĐã có trong hệ thống.\nVui lòng kiểm tra lại!");
                 SetErrorStatus(true, "NG",
                                $"PCB [{txtProductionID.Text}] đã có trong hệ thống.\nVui lòng kiểm tra lại\n" +
                                $"Box ID: {production.BoxID} " +
                                $"Operator: {production.OperatorCode} " +
                                $"Date Check: {production.DateCheck}");
                 txtProductionID.SelectAll();
                 Ultils.EditTextErrorNoMessage(txtProductionID);
             }
             else
             {
                 txtMacAddress.Focus();
                 SetErrorStatus(false, "OK", null);
             }
         }
     }
     if (e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtProductionID.Text))
         {
             Ultils.TextControlNotNull(txtProductionID, "Production ID");
         }
     }
 }
예제 #7
0
파일: FormLogin.cs 프로젝트: imatary/work
 private void txtProcess_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtProcess.Text))
         {
             dxErrorProvider1.SetError(txtProcess, "Error! Process value required.");
             Ultils.EditTextErrorNoMessage(txtProcess);
         }
         else
         {
             btnLogin.PerformClick();
         }
     }
 }
예제 #8
0
파일: FormMain.cs 프로젝트: imatary/work
 private void txtProductionID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         _dateTimeCheck = DateTime.Now;
         if (string.IsNullOrEmpty(txtProductID.Text))
         {
             SetErrorStatus("NG", $"Label không được để trống!");
             Ultils.EditTextErrorNoMessage(txtProductID);
         }
         else
         {
             string productionId = txtProductID.Text.Trim();
             if (productionId.Length < 8)
             {
                 SetErrorStatus("NG", $"Error! Label không đúng định dạng!");
                 txtProductID.SelectAll();
                 Ultils.EditTextErrorNoMessage(txtProductID);
             }
             else
             {
                 if (Program.CurrentUser.OperationID == 1)
                 {
                     var production = _oqcService.GetLogByProductionId(productionId);
                     if (production != null)
                     {
                         SetErrorStatus("NG",
                                        $"PCB [{txtProductID.Text}] đã có trong hệ thống. Vui lòng kiểm tra lại\n" +
                                        $"Box ID: {production.BoxID}");
                         txtProductID.ResetText();
                         Ultils.EditTextErrorNoMessage(txtProductID);
                     }
                     else
                     {
                         InsertLog(txtBoxID.Text.Trim());
                     }
                 }
                 else if (Program.CurrentUser.OperationID >= 2)
                 {
                     InsertLog(txtBoxID.Text.Trim());
                 }
             }
         }
     }
 }
예제 #9
0
        private void txtModelUMC_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string modelName = txtModelUMC.Text.Trim();
                if (!string.IsNullOrEmpty(modelName))
                {
                    _model = _modelService.GetModelByName(modelName, "MURATA");
                    if (_model != null)
                    {
                        lblQuantityModel.Visible      = true;
                        lblQuantityModel.Text         = $"/{_model.Quantity}";
                        tableLayoutPanelModel.Visible = true;
                        lblCurentModel.Text           = _model.ModelName;
                        lblSerialNo.Text     = _model.SerialNo;
                        lblCustomerName.Text = $"Barcode {_model.CustomerName}";
                        modelID = _model.ModelID;

                        if (_model.CheckWidthModelCus == true)
                        {
                            EnbaleCheckWidthModelCus(true);
                        }
                        else
                        {
                            EnbaleCheckWidthModelCus(false);
                            txtBoxID.Enabled     = true;
                            checkPASS.Enabled    = true;
                            checkNG.Enabled      = true;
                            txtProductID.Enabled = true;
                            txtBoxID.Focus();
                        }
                    }
                    else
                    {
                        SetErrorStatus("NG", $"Sai Model. Vui lòng kiểm tra lại!");
                        Ultils.EditTextErrorNoMessage(txtModelUMC);
                    }
                }
                else
                {
                    SetErrorStatus("NG", $"Vui lòng nhập vào Model UMC trước!");
                    Ultils.EditTextErrorNoMessage(txtModelUMC);
                }
            }
        }
예제 #10
0
 private void txtBoxID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtBoxID.Text))
         {
             SetErrorStatus("NG", "Box ID không được để trống!");
             Ultils.EditTextErrorNoMessage(txtBoxID);
         }
         else
         {
             string strBoxId = txtBoxID.Text;
             if (strBoxId.Length >= 3)
             {
                 if (strBoxId.Substring(0, 3).ToUpper() != "F00")
                 {
                     SetErrorStatus("NG", "BOX ID phải bắt đầu bằng F00!");
                     Ultils.EditTextErrorNoMessage(txtBoxID);
                     txtBoxID.SelectAll();
                 }
                 else
                 {
                     if (checkModelCUS.Checked == false)
                     {
                         EnableBoxIDWidthModel(false);
                         EnableLabelMurata(false);
                         txtProductID.Focus();
                     }
                     else
                     {
                         EnableBoxIDWidthModel(false);
                         EnableLabelMurata(true);
                         txtProductID.Focus();
                     }
                 }
             }
             else
             {
                 SetErrorStatus("NG", "BOX ID không đúng định đạng!");
                 Ultils.EditTextErrorNoMessage(txtBoxID);
             }
         }
     }
 }
예제 #11
0
 private void txtBoxID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtBoxID.Text))
         {
             SetErrorStatus("NG", "Box ID không được để trống!");
             Ultils.EditTextErrorNoMessage(txtBoxID);
         }
         else
         {
             string strBoxId = txtBoxID.Text;
             if (strBoxId.Length >= 3)
             {
                 if (strBoxId.Length > 10)
                 {
                     SetErrorStatus("NG", "BOX không được dài quá 10 ký tự!");
                     Ultils.EditTextErrorNoMessage(txtBoxID);
                     Ultils.EditTextErrorNoMessage(txtBoxID);
                 }
                 else
                 {
                     if (strBoxId.Substring(0, 3).ToUpper() != "F00")
                     {
                         SetErrorStatus("NG", "BOX ID phải bắt đầu bằng F00!");
                         Ultils.EditTextErrorNoMessage(txtBoxID);
                         txtBoxID.SelectAll();
                     }
                     else
                     {
                         SetDefaultStatus("N/A", "no results");
                         txtBoxID.Enabled = false;
                         txtProductionID.Focus();
                     }
                 }
             }
             else
             {
                 SetErrorStatus("NG", "BOX ID không đúng định đạng!");
                 Ultils.EditTextErrorNoMessage(txtBoxID);
             }
         }
     }
 }
예제 #12
0
 private void txtModelCUS_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         string labelMurata = txtModelCUS.Text.Trim();
         if (!string.IsNullOrEmpty(labelMurata))
         {
             if (labelMurata.Length > 10)
             {
                 if (labelMurata.Contains(codeMurata))
                 {
                     var murata = _murataService.GetProducts_Murata_by_ModelCustomer(labelMurata);
                     if (murata != null)
                     {
                         SetErrorStatus("NG", $"Label {labelMurata} đã tồn tại.\nLabel: {murata.ModelName}\nIn Box:{murata.BoxID}");
                         Ultils.EditTextErrorNoMessage(txtProductID);
                         txtModelCUS.ResetText();
                     }
                     else
                     {
                         InsertLog(txtBoxID.Text.Trim());
                     }
                 }
                 else
                 {
                     SetErrorStatus("NG", $"Sai Label. Vui lòng kiểm tra và bắn lại!");
                     Ultils.EditTextErrorNoMessage(txtModelCUS);
                 }
             }
             else
             {
                 SetErrorStatus("NG", $"Sai Label. Vui lòng kiểm tra và bắn lại!");
                 Ultils.EditTextErrorNoMessage(txtModelUMC);
             }
         }
         else
         {
             SetErrorStatus("NG", $"Vui lòng nhập vào Label!");
             Ultils.EditTextErrorNoMessage(txtModelUMC);
         }
     }
 }
예제 #13
0
 private void txtProductionID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtProductionID.Text))
         {
             SetErrorStatus(true, "NG", $"Production ID không được để trống!");
             Ultils.EditTextErrorNoMessage(txtProductionID);
         }
         else
         {
             string productionId = txtProductionID.Text.Trim();
             if (Program.CurrentUser.OperationID == 1)
             {
                 var production = _oqcService.GetLogByProductionId(productionId);
                 if (production != null)
                 {
                     SetErrorStatus(true, "NG",
                                    $"PCB [{txtProductionID.Text}] đã có trong hệ thống.\nVui lòng kiểm tra lại\n" +
                                    $"Box ID: {production.BoxID} \n" +
                                    $"Operator: {production.OperatorCode} \n" +
                                    $"Date Check: {production.DateCheck} \n");
                     txtProductionID.SelectAll();
                     Ultils.EditTextErrorNoMessage(txtProductionID);
                 }
                 else
                 {
                     SetErrorStatus(false, null, null);
                     InsertLog(txtBoxID.Text.Trim());
                 }
             }
             else if (Program.CurrentUser.OperationID >= 2)
             {
                 txtJudge.Focus();
                 SetErrorStatus(false, null, null);
             }
         }
     }
 }
예제 #14
0
파일: FormMurata.cs 프로젝트: imatary/work
        private void txtProductionID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                _dateTimeCheck = DateTime.Now;

                // Nếu PCB rỗng, thì thông báo lỗi
                if (string.IsNullOrEmpty(txtProductID.Text))
                {
                    SetErrorStatus("NG", $"Label không được để trống!");
                    Ultils.EditTextErrorNoMessage(txtProductID);
                }
                else if (string.IsNullOrEmpty(txtBoxID.Text))
                {
                    SetErrorStatus("NG", $"Box không được để trống!");
                    Ultils.EditTextErrorNoMessage(txtBoxID);
                }
                else
                {
                    string productionId = txtProductID.Text.Trim();
                    // Nếu chuỗi PCB có dộ dài mà nhỏ hơn 16,
                    // thì thông báo lỗi cho người dùng biết.
                    if (productionId.Length <= 16)
                    {
                        SetErrorStatus("NG", $"Error! Label không đúng định dạng!");
                        txtProductID.SelectAll();
                        Ultils.EditTextErrorNoMessage(txtProductID);
                    }
                    else
                    {
                        // Nếu PCB, giống với ModelName đang chạy,
                        string[] strSpit = productionId.Split(' ');
                        //string beginWidth=productionId.StartsWith()
                        if (strSpit[0] == lblCurentModel.Text && productionId.Contains(lblSerialNo.Text))
                        {
                            var production = _murataService.GetProducts_Murata_by_ID(productionId);
                            if (production != null)
                            {
                                SetErrorStatus("NG",
                                               $"PCB [{productionId}] đã có trong hệ thống. Vui lòng kiểm tra lại\n" +
                                               $"Box ID: {production.BoxID}");
                                txtProductID.ResetText();
                                Ultils.EditTextErrorNoMessage(txtProductID);
                            }
                            else
                            {
                                if (Program.CurrentUser.CheckItemOnWIP == true)
                                {
                                    var checkMes = _mesService.Get_WORK_ORDER_ITEMS_By_BoardNo(productionId);
                                    // Kiểm tra sự tồn tại của bản mạch có trên hệ thống WIP chưa?
                                    // Nếu có rồi thì thực hiện kiểm tra các bước tiếp theo
                                    if (checkMes != null)
                                    {
                                        // 1 => OK
                                        // 2 => NG
                                        // 3 => Discard

                                        // Nếu trạng thái bản mạch đang là 'NG'
                                        if (checkMes.BOARD_STATE == 2)
                                        {
                                            try
                                            {
                                                _murataService.DeleteLogByProductionId(productionId);
                                            }
                                            catch (Exception ex)
                                            {
                                                MessageBox.Show($"Delete error!\n{ex.Message}", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                            }

                                            if (checkModelCUS.Checked == true)
                                            {
                                                txtModelCUS.Focus();
                                            }
                                            else
                                            {
                                                InsertLog(txtBoxID.Text);
                                            }
                                        }
                                        // Nếu trạng thái bản mạch đang là Discard
                                        else if (checkMes.BOARD_STATE == 3)
                                        {
                                            SetErrorStatus("NG", $"PCB [{productionId}] này đã được loại bỏ. Vui lòng kiểm tra lại!");
                                            Ultils.EditTextErrorNoMessage(txtProductID);
                                        }
                                        // Nếu bản mạch này đã finished
                                        else if (checkMes.IS_FINISHED == true)
                                        {
                                            SetErrorStatus("OK", $"[{productionId}] đã hoàn thành. Vui lòng kiểm tra lại!");
                                            Ultils.EditTextErrorNoMessage(txtProductID);
                                        }
                                        // Trạng thái bản mạch OK
                                        else if (checkMes.BOARD_STATE == 1)
                                        {
                                            if (checkModelCUS.Checked == true)
                                            {
                                                txtModelCUS.Focus();
                                            }
                                            else
                                            {
                                                InsertLog(txtBoxID.Text);
                                            }
                                        }
                                    }
                                    // Nếu bản mạch chưa có trên hệ thống WIP thì thông báo lỗi
                                    // cho người dùng
                                    else
                                    {
                                        SetErrorStatus("NG", $"[{productionId}]\nChưa khởi tạo trên WIP. Vui lòng kiểm tra lại!");
                                        Ultils.EditTextErrorNoMessage(txtProductID);
                                    }
                                }
                                else
                                {
                                    if (checkModelCUS.Checked == true)
                                    {
                                        txtModelCUS.Focus();
                                    }
                                    else
                                    {
                                        InsertLog(txtBoxID.Text);
                                    }
                                }
                            }
                        }
                        else
                        {
                            SetErrorStatus("NG", $"Sai Label. Vui lòng kiểm tra lại!");
                            Ultils.EditTextErrorNoMessage(txtProductID);
                        }
                    }
                }
            }
        }
예제 #15
0
        private void txtProductionID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                _dateTimeCheck = DateTime.Now;
                if (string.IsNullOrEmpty(txtProductID.Text))
                {
                    SetErrorStatus("NG", $"Label không được để trống!");
                    Ultils.EditTextErrorNoMessage(txtProductID);
                }
                else
                {
                    string productionId = txtProductID.Text.Trim();
                    if (productionId.Length <= 16)
                    {
                        SetErrorStatus("NG", $"Error! Label không đúng định dạng!");
                        txtProductID.SelectAll();
                        Ultils.EditTextErrorNoMessage(txtProductID);
                    }
                    else
                    {
                        if (productionId.Contains(lblCurentModel.Text) && productionId.Contains(lblSerialNo.Text))
                        {
                            if (Program.CurrentUser.OperationID == 1)
                            {
                                var production = _oqcService.GetLogByProductionId(productionId);
                                if (production != null)
                                {
                                    SetErrorStatus("NG",
                                                   $"PCB [{txtProductID.Text}] đã có trong hệ thống. Vui lòng kiểm tra lại\n" +
                                                   $"Box ID: {production.BoxID}");
                                    txtProductID.ResetText();
                                    Ultils.EditTextErrorNoMessage(txtProductID);
                                }
                                else
                                {
                                    bool _checkMes = false;
                                    var  checkMes  = _mesService.Get_WORK_ORDER_ITEMS_By_BoardNo(productionId);
                                    if (checkMes != null)
                                    {
                                        if (checkMes.BOARD_STATE > 1)
                                        {
                                            _checkMes = true;
                                        }
                                    }

                                    if (!_checkMes)
                                    {
                                        if (checkModelCUS.Checked == true)
                                        {
                                            txtModelCUS.Focus();
                                        }
                                        else
                                        {
                                            InsertLog(txtBoxID.Text.Trim());
                                        }
                                    }
                                    else
                                    {
                                        SetErrorStatus("NG", $"NG WIP. Vui lòng kiểm tra lại!");
                                        Ultils.EditTextErrorNoMessage(txtProductID);
                                    }
                                }
                            }
                            else if (Program.CurrentUser.OperationID >= 2)
                            {
                                InsertLog(txtBoxID.Text.Trim());
                            }
                        }
                        else
                        {
                            SetErrorStatus("NG", $"Sai Label. Vui lòng kiểm tra lại!");
                            Ultils.EditTextErrorNoMessage(txtProductID);
                        }
                    }
                }
            }
        }
예제 #16
0
        /// <summary>
        /// Insert Log
        /// </summary>
        /// <param name="boxId"></param>
        private void InsertLog(string boxId)
        {
            if (!string.IsNullOrEmpty(txtProductionID.Text.Trim()) ||
                !string.IsNullOrEmpty(txtMacAddress.Text.Trim()) ||
                !string.IsNullOrEmpty(txtJudge.Text.Trim()))
            {
                int    lineId      = Program.CurrentUser.LineID;
                int    operationId = Program.CurrentUser.OperationID;
                string operatorId  = Program.CurrentUser.OperatorCode;
                bool   judge       = txtJudge.Text.Trim() == "1";

                if (operationId == 1)
                {
                    var logs = _oqcService.GetLogsByBoxId(boxId).ToList();
                    // Nếu Box có dữ liệu của PCB
                    if (logs.Any())
                    {
                        var log = logs.FirstOrDefault(l => l.ProductionID == txtProductionID.Text);
                        // Nếu PCB mới bắn vào chưa có trong Box
                        if (log == null)
                        {
                            if (!CheckProductionId(txtProductionID.Text, lblCurentModel.Text, lblSerialNo.Text))
                            {
                                SetErrorStatus(true, "NG", $"Error {lblCurentModel.Text} !\nPCB [{txtProductionID.Text}]\nnày khác với các PCB trong Box [{boxId}].\nVui lòng kiểm tra lại!");
                                txtProductionID.SelectAll();
                                Ultils.EditTextErrorNoMessage(txtProductionID);
                                txtJudge.ResetText();
                                txtMacAddress.ResetText();
                                txtBoxID.ResetText();
                            }
                            else
                            {
                                string tmp           = lblQuantityModel.Text.Replace("/", "");
                                int    countPcbInBox = int.Parse(lblCountPCB.Text);
                                int    quantity      = int.Parse(tmp);

                                if (countPcbInBox == quantity)
                                {
                                    SetErrorStatus(true, "OK", "Thùng đã đủ số lượng, vui lòng kiểm tra lại!");
                                    ResetControls();
                                }
                                else
                                {
                                    try
                                    {
                                        _iqcService.InsertLogs(txtProductionID.Text, lineId, txtMacAddress.Text, boxId, null, null, 1, operatorId);

                                        if (!_iqcService.CheckResultExits(txtProductionID.Text, operationId))
                                        {
                                            _iqcService.InsertResult(txtProductionID.Text, operationId, judge, operatorId);
                                        }
                                        else
                                        {
                                            _iqcService.UpdateResult(txtProductionID.Text, operationId, judge, operatorId);
                                        }
                                        var refeshData = _iqcService.GetLogs(boxId).ToList();
                                        gridControlData.Refresh();
                                        gridControlData.DataSource = refeshData;
                                        lblCountPCB.Text           = refeshData.Count.ToString(CultureInfo.InvariantCulture);

                                        SetSuccessStatus(true, "PASS", string.Format("Thêm thành công!\nPCB [{0}]", txtProductionID.Text));
                                        ResetControls();
                                    }
                                    catch (Exception ex)
                                    {
                                        SetErrorStatus(true, "NG", "Error Insert! \n" + ex.Message);
                                        ResetControls();
                                    }
                                }
                            }
                        }
                        // Nếu có rồi thì thống báo lỗi
                        else
                        {
                            SetErrorStatus(true, "NG", $"PCB [{txtProductionID.Text}] này đã có trong Box rồi.\nVui lòng kiểm tra lại");
                            ResetControls();
                            var refeshData = _oqcService.GetLogsByBoxId(boxId);
                            gridControlData.Refresh();
                            gridControlData.DataSource = refeshData;
                        }
                    }
                    // Nếu Box chưa có dữ liệu gì, thực hiện insert
                    else
                    {
                        try
                        {
                            _iqcService.InsertLogs(txtProductionID.Text, lineId, txtMacAddress.Text, boxId, null, null, 1, operatorId);

                            if (!_iqcService.CheckResultExits(txtProductionID.Text, operationId))
                            {
                                _iqcService.InsertResult(txtProductionID.Text, operationId, judge, operatorId);
                            }
                            else
                            {
                                _iqcService.UpdateResult(txtProductionID.Text, operationId, judge, operatorId);
                            }
                            var refeshData = _iqcService.GetLogs(boxId).ToList();
                            gridControlData.Refresh();
                            gridControlData.DataSource = refeshData;
                            lblCountPCB.Text           = refeshData.Count.ToString(CultureInfo.InvariantCulture);

                            SetSuccessStatus(true, "PASS", string.Format("Thêm thành công!\nPCB [{0}]", txtProductionID.Text));
                            ResetControls();
                        }
                        catch (Exception ex)
                        {
                            SetErrorStatus(true, "NG", "Error Insert! \n" + ex.Message);
                            ResetControls();
                        }
                    }
                }
                else if (operationId >= 2)
                {
                    _iqcService.UpdateLogs(txtProductionID.Text, lineId, txtMacAddress.Text, boxId, null, null, 1, operatorId);
                    _iqcService.InsertResult(txtProductionID.Text, operationId, judge, operatorId);

                    var refeshData = _iqcService.GetLogs(boxId).ToList();
                    gridControlData.Refresh();
                    gridControlData.DataSource = refeshData;
                    lblCountPCB.Text           = refeshData.Count.ToString(CultureInfo.InvariantCulture);

                    SetSuccessStatus(true, "PASS", string.Format("Thành công!\nPCB [{0}] vừa được bắn lại lần {1}", txtProductionID.Text, operationId));
                    ResetControls();
                }
            }
            else
            {
                SetErrorStatus(true, "NG", "Vui lòng nhập đủ thông tin!");
                txtProductionID.Focus();
            }
        }
예제 #17
0
        /// <summary>
        /// Insert Log
        /// </summary>
        /// <param name="boxId"></param>
        private void InsertLog(string boxId)
        {
            if (!string.IsNullOrEmpty(txtProductionID.Text.Trim()) ||
                !string.IsNullOrEmpty(txtBoxID.Text.Trim()))
            {
                int    lineId       = Program.CurrentUser.LineID;
                int    operationId  = Program.CurrentUser.OperationID;
                string operatorId   = Program.CurrentUser.OperatorCode;
                string productionId = txtProductionID.Text.Trim();

                string status = null;
                bool   judge  = false;
                if (checkPASS.Checked == true)
                {
                    status = "P";
                    judge  = true;
                }
                if (checkNG.Checked == true)
                {
                    status = "F";
                    judge  = false;
                }

                var logs = _oqcService.GetLogsByBoxId(boxId).ToList();

                // Nếu Box có dữ liệu của PCB
                if (logs.Any())
                {
                    var log = logs.SingleOrDefault(l => l.ProductionID == productionId);
                    // Nếu PCB mới bắn vào chưa có trong Box
                    if (log == null)
                    {
                        var model = _modelService.GetModelById(logs.FirstOrDefault().ModelID);
                        // Nếu Production ID, có Model giống với Model hiện tại
                        if (productionId.Contains(model.ModelName) && productionId.Contains(model.SerialNo))
                        {
                            string tmp           = lblQuantityModel.Text.Replace("/", "");
                            int    countPcbInBox = int.Parse(lblCountPCB.Text);
                            int    quantity      = int.Parse(tmp);

                            if (logs.Count == quantity)
                            {
                                SetErrorStatus("NG", $"Box [{txtBoxID.Text}] đã đủ số lượng. Vui lòng kiểm tra lại!");
                                Ultils.EditTextErrorNoMessage(txtBoxID);
                                checkFujiHP.Checked = false;
                                txtBoxID.Enabled    = true;
                                txtBoxID.Focus();
                                txtBoxID.ResetText();
                            }
                            else
                            {
                                try
                                {
                                    _iqcService.InsertLogs(productionId, lineId, txtMacAddress.Text, boxId, modelID, "N/T", 1, operatorId, false, "IT", StringHelper.GetInfo(), "tmp");

                                    if (!_iqcService.CheckResultExits(productionId, operationId))
                                    {
                                        _iqcService.InsertResult(productionId, operationId, judge, operatorId, _dateTimeCheck);
                                    }
                                    else
                                    {
                                        _iqcService.UpdateResult(productionId, operationId, judge, operatorId);
                                    }
                                    Ultils.CreateFileLog(lblCurentModel.Text, productionId, status, Program.CurrentUser.ProcessID, _dateTimeCheck);
                                    logs = _oqcService.GetLogsByBoxId(boxId).ToList();
                                    gridControlData.Refresh();
                                    gridControlData.DataSource = logs;
                                    lblCountPCB.Text           = logs.Count.ToString(CultureInfo.InvariantCulture);

                                    SetSuccessStatus("PASS", $"Thành công!\nPCB [{txtProductionID.Text}]");
                                    txtProductionID.ResetText();
                                    txtProductionID.Focus();

                                    if (logs.Count == quantity)
                                    {
                                        SetSuccessStatus("OK", $"Box [{txtBoxID.Text}] đã đủ số lượng!");
                                        Ultils.EditTextErrorNoMessage(txtBoxID);
                                        txtBoxID.Enabled = true;
                                        txtBoxID.Focus();
                                        txtBoxID.ResetText();
                                    }
                                }
                                catch (Exception ex)
                                {
                                    SetErrorStatus("NG", "Model chưa có trong hệ thống!\nVui lòng nhập model này vào, và thử lại. \n" + ex.Message);
                                    txtProductionID.ResetText();
                                    txtProductionID.Focus();
                                }
                            }
                        }
                        else
                        {
                            SetErrorStatus("NG", $"Sai Model: {lblCurentModel.Text} !\nPCB [{productionId}] này khác với các PCB trong Box [{boxId}].\nVui lòng kiểm tra lại!");
                            txtProductionID.ResetText();
                            txtProductionID.Focus();
                            Ultils.EditTextErrorNoMessage(txtProductionID);

                            logs = _oqcService.GetLogsByBoxId(boxId).ToList();
                            gridControlData.Refresh();
                            gridControlData.DataSource = logs;
                            lblCountPCB.Text           = logs.Count.ToString(CultureInfo.InvariantCulture);
                        }
                    }
                    // Nếu có rồi thì thống báo lỗi
                    else
                    {
                        SetErrorStatus("NG", $"PCB [{txtProductionID.Text}] này đã có trong Box rồi.\nVui lòng kiểm tra lại");
                        txtProductionID.ResetText();
                        txtProductionID.Focus();
                        gridControlData.Refresh();
                        gridControlData.DataSource = logs;
                        lblCountPCB.Text           = logs.Count.ToString(CultureInfo.InvariantCulture);
                    }
                }
                // Nếu Box chưa có dữ liệu gì, thực hiện insert
                else
                {
                    try
                    {
                        _iqcService.InsertLogs(productionId, lineId, txtMacAddress.Text, boxId, modelID, "N/T", 1, operatorId, false, "IT", StringHelper.GetInfo(), "tmp");

                        if (!_iqcService.CheckResultExits(txtProductionID.Text, operationId))
                        {
                            _iqcService.InsertResult(productionId, operationId, judge, operatorId, _dateTimeCheck);
                        }
                        else
                        {
                            _iqcService.UpdateResult(productionId, operationId, judge, operatorId);
                        }
                        Ultils.CreateFileLog(lblCurentModel.Text, productionId, status, Program.CurrentUser.ProcessID, _dateTimeCheck);
                        logs = _oqcService.GetLogsByBoxId(boxId).ToList();
                        gridControlData.Refresh();
                        gridControlData.DataSource = logs;
                        lblCountPCB.Text           = logs.Count.ToString(CultureInfo.InvariantCulture);

                        SetSuccessStatus("PASS", string.Format("Thêm thành công!\nPCB [{0}]", productionId));
                        txtProductionID.ResetText();
                        txtProductionID.Focus();
                    }
                    catch (Exception ex)
                    {
                        SetErrorStatus("NG", "Error Insert! \n" + ex.Message);
                        txtProductionID.ResetText();
                        txtProductionID.Focus();
                    }
                }
            }
            else
            {
                SetErrorStatus("NG", "Vui lòng nhập đủ thông tin!");
                txtProductionID.Focus();
                txtProductionID.SelectAll();
            }
        }
예제 #18
0
        private void txtProductionID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                _dateTimeCheck = DateTime.Now;
                string productionId = txtProductionID.Text.Trim();
                if (string.IsNullOrEmpty(productionId))
                {
                    SetErrorStatus("NG", $"Production ID không được để trống!");
                    Ultils.EditTextErrorNoMessage(txtProductionID);
                }
                else
                {
                    if (productionId.Length <= 10)
                    {
                        SetErrorStatus("NG", $"Error!\nPCB không đúng định dạng!");
                        txtProductionID.SelectAll();
                        Ultils.EditTextErrorNoMessage(txtProductionID);
                    }
                    else
                    {
                        string currentModel = null;
                        if (productionId.Contains("_"))
                        {
                            string[] model = productionId.Split('_');
                            currentModel = model[1].Substring(0, 10);
                        }

                        var models = _modelService.GetModelLikeName(currentModel, FujiXerox);

                        if (checkFujiHP.Checked == true)
                        {
                            if ((models.ModelName == "105K 33480") || (models.ModelName == "105K 33470"))
                            {
                                quantity = models.QuantityHP;
                            }
                            else
                            {
                                SetErrorStatus("NG", $"Vui lòng kiểm tra lại");
                                checkFujiHP.Checked = false;
                            }
                        }
                        else
                        {
                            quantity = models.Quantity;
                        }

                        lblQuantityModel.Visible      = true;
                        lblQuantityModel.Text         = $"/{quantity}";
                        tableLayoutPanelModel.Visible = true;
                        lblCurentModel.Text           = models.ModelName;
                        lblSerialNo.Text     = models.SerialNo;
                        lblCustomerName.Text = $"Barcode {models.CustomerName}";
                        modelID = models.ModelID;

                        if (Program.CurrentUser.OperationID == 1)
                        {
                            var production = _oqcService.GetLogByProductionId(productionId);
                            if (production != null)
                            {
                                SetErrorStatus("NG",
                                               $"PCB [{txtProductionID.Text}] đã có trong hệ thống. Vui lòng kiểm tra lại\n" +
                                               $"Box ID: {production.BoxID}");
                                txtProductionID.ResetText();
                                Ultils.EditTextErrorNoMessage(txtProductionID);
                            }
                            else
                            {
                                SetErrorStatus("N/A", "no results");
                                InsertLog(txtBoxID.Text.Trim());
                            }
                        }
                        else if (Program.CurrentUser.OperationID >= 2)
                        {
                            SetErrorStatus("N/A", "no results");
                            InsertLog(txtBoxID.Text.Trim());
                        }
                    }
                }
            }
            if (e.KeyCode == Keys.Tab)
            {
                if (string.IsNullOrEmpty(txtProductionID.Text))
                {
                    SetErrorStatus("NG", $"Production ID không được để trống!");
                    Ultils.EditTextErrorNoMessage(txtProductionID);
                }
            }
        }
예제 #19
0
        /// <summary>
        /// Insert Log
        /// </summary>
        /// <param name="boxId"></param>
        private void InsertLog(string boxId)
        {
            if (!string.IsNullOrEmpty(txtProductID.Text.Trim()) ||
                !string.IsNullOrEmpty(txtBoxID.Text.Trim()) ||
                !string.IsNullOrEmpty(txtModelUMC.Text.Trim()))
            {
                int    lineId       = Program.CurrentUser.LineID;
                int    operationId  = Program.CurrentUser.OperationID;
                string operatorId   = Program.CurrentUser.OperatorCode;
                string productionId = txtProductID.Text.Trim();

                string status = null;
                bool   judge  = false;
                if (checkPASS.Checked == true)
                {
                    status = "P";
                    judge  = true;
                }
                if (checkNG.Checked == true)
                {
                    status = "F";
                    judge  = false;
                }
                var logs = _murataService.GetProducts_Murata_by_BoxId(boxId).ToList();
                if (operationId == 1)
                {
                    // Nếu Box có dữ liệu của PCB
                    if (logs.Any())
                    {
                        var log = logs.SingleOrDefault(l => l.ProductionID == productionId);
                        // Nếu PCB mới bắn vào chưa có trong Box
                        if (log == null)
                        {
                            var checkModelInBox = logs.FirstOrDefault();
                            // Nếu Production ID, có Model giống với Model hiện tại
                            if (productionId.Contains(checkModelInBox.ModelName))
                            {
                                string tmp           = lblQuantityModel.Text.Replace("/", "");
                                int    countPcbInBox = int.Parse(lblCountPCB.Text);
                                int    quantity      = int.Parse(tmp);

                                if (logs.Count == quantity)
                                {
                                    SetErrorStatus("NG", $"Box [{txtBoxID.Text}] đã đủ số lượng. Vui lòng kiểm tra lại!");
                                    Ultils.EditTextErrorNoMessage(txtBoxID);
                                    EnableBoxIDWidthModel(true);
                                    if (checkModelCUS.Checked == true)
                                    {
                                        EnbaleCheckWidthModelCus(true);
                                    }
                                    else
                                    {
                                        EnbaleCheckWidthModelCus(false);
                                    }
                                    txtProductID.ResetText();
                                }
                                else
                                {
                                    try
                                    {
                                        _iqcService.InsertLogs(productionId, lineId, "N/A", boxId, modelID, "N/T", 1, operatorId, false, "IT", StringHelper.GetInfo(), txtModelCUS.Text.Trim());

                                        if (!_iqcService.CheckResultExits(productionId, operationId))
                                        {
                                            _iqcService.InsertResult(productionId, operationId, judge, operatorId, _dateTimeCheck);
                                        }
                                        else
                                        {
                                            _iqcService.UpdateResult(productionId, operationId, judge, operatorId);
                                        }
                                        Ultils.CreateFileLog(lblCurentModel.Text, productionId, status, Program.CurrentUser.ProcessID, _dateTimeCheck);
                                        Ultils.CreateFileLogDirModelName(lblCurentModel.Text, productionId, status, Program.CurrentUser.ProcessID, _dateTimeCheck);
                                        logs = _murataService.GetProducts_Murata_by_BoxId(boxId).ToList();
                                        gridControlData.Refresh();
                                        gridControlData.DataSource = logs;
                                        lblCountPCB.Text           = logs.Count.ToString(CultureInfo.InvariantCulture);

                                        SetSuccessStatus("OK", $"Thành công!\nPCB [{txtProductID.Text}]");
                                        ResetControls();
                                        if (logs.Count() == quantity)
                                        {
                                            SetErrorStatus("NG", $"Box [{txtBoxID.Text}] đã đủ số lượng. Vui lòng lấy box mới!");
                                            Ultils.EditTextErrorNoMessage(txtBoxID);
                                            EnableBoxIDWidthModel(true);
                                            if (checkModelCUS.Checked == true)
                                            {
                                                EnbaleCheckWidthModelCus(true);
                                            }
                                            else
                                            {
                                                EnbaleCheckWidthModelCus(false);
                                            }
                                            txtProductID.ResetText();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        SetErrorStatus("NG", "Model chưa có trong hệ thống!\nVui lòng nhập model này vào, và thử lại. \n" + ex.Message);
                                        ResetControls();
                                    }
                                }
                            }
                            else
                            {
                                SetErrorStatus("NG", "Sai Model! Vui lòng kiểm tra và thử lại!");
                                Ultils.EditTextErrorNoMessage(txtProductID);
                                ResetControls();
                                logs = _murataService.GetProducts_Murata_by_BoxId(boxId).ToList();
                                gridControlData.Refresh();
                                gridControlData.DataSource = logs;
                                lblCountPCB.Text           = logs.Count.ToString(CultureInfo.InvariantCulture);
                            }
                        }
                        // Nếu có rồi thì thống báo lỗi
                        else
                        {
                            SetErrorStatus("NG", $"PCB [{txtProductID.Text}] này đã có trong Box rồi.\nVui lòng kiểm tra lại");
                            ResetControls();
                            gridControlData.Refresh();
                            gridControlData.DataSource = logs;
                            lblCountPCB.Text           = logs.Count.ToString(CultureInfo.InvariantCulture);
                        }
                    }
                    // Nếu Box chưa có dữ liệu gì, thực hiện insert
                    else
                    {
                        try
                        {
                            _iqcService.InsertLogs(productionId, lineId, "N/A", boxId, modelID, "N/T", 1, operatorId, false, "IT", StringHelper.GetInfo(), txtModelCUS.Text.Trim());

                            if (!_iqcService.CheckResultExits(txtProductID.Text, operationId))
                            {
                                _iqcService.InsertResult(productionId, operationId, judge, operatorId, _dateTimeCheck);
                            }
                            else
                            {
                                _iqcService.UpdateResult(productionId, operationId, judge, operatorId);
                            }
                            Ultils.CreateFileLog(lblCurentModel.Text, productionId, status, Program.CurrentUser.ProcessID, _dateTimeCheck);
                            Ultils.CreateFileLogDirModelName(lblCurentModel.Text, productionId, status, Program.CurrentUser.ProcessID, _dateTimeCheck);
                            logs = _murataService.GetProducts_Murata_by_BoxId(boxId).ToList();
                            gridControlData.Refresh();
                            gridControlData.DataSource = logs;
                            lblCountPCB.Text           = logs.Count.ToString(CultureInfo.InvariantCulture);

                            SetSuccessStatus("OK", string.Format("Thêm thành công!\nPCB [{0}]", productionId));
                            ResetControls();
                        }
                        catch (Exception ex)
                        {
                            SetErrorStatus("NG", "Error Insert! \n" + ex.Message);
                            ResetControls();
                        }
                    }
                }
                else if (operationId >= 2)
                {
                    _iqcService.UpdateLogs(productionId, lineId, "N/A", boxId, modelID, null, operatorId, txtModelCUS.Text.Trim());
                    _iqcService.InsertResult(productionId, operationId, judge, operatorId, _dateTimeCheck);

                    logs = _murataService.GetProducts_Murata_by_BoxId(boxId).ToList();
                    gridControlData.Refresh();
                    gridControlData.DataSource = logs;
                    lblCountPCB.Text           = logs.Count.ToString(CultureInfo.InvariantCulture);

                    SetSuccessStatus("OK", string.Format("Thành công!\nPCB [{0}] vừa được bắn lại lần {1}", productionId, operationId));
                    ResetControls();
                }
            }
            else
            {
                SetErrorStatus("NG", "Vui lòng nhập đủ thông tin!");
                EnableBoxIDWidthModel(true);
                txtBoxID.Focus();
            }
        }
예제 #20
0
파일: FormQACheck.cs 프로젝트: imatary/work
 private void txtProductionID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtProductionID.Text))
         {
             Ultils.TextControlNotNull(txtProductionID, "Production ID");
         }
         else
         {
             string productionId = txtProductionID.Text.Trim();
             if (checkBox1.Checked == true)
             {
                 productionId         = productionId.Replace("_", "");
                 txtProductionID.Text = productionId;
             }
             foreach (var item in _modelService.GetModels())
             {
                 if (productionId.Contains(item.ModelName.ToUpper()))
                 {
                     lblQuantityModel.Visible      = true;
                     lblQuantityModel.Text         = $"/{item.Quantity}";
                     tableLayoutPanelModel.Visible = true;
                     lblCurentModel.Text           = item.ModelName;
                     lblSerialNo.Text = item.SerialNo;
                     break;
                 }
             }
             _log = _oqcService.GetLogByProductionId(productionId);
             if (_log != null)
             {
                 if (_log.QA_Check == false)
                 {
                     txtJudge.Focus();
                     SetErrorStatus(false, "OK", null);
                 }
                 else
                 {
                     SetSuccessStatus(true, "OK",
                                      $"PCB [{productionId}] đã được kiểm tra rồi.\n" +
                                      $"Box ID: {_log.BoxID} \n" +
                                      $"Operator: {_log.OperatorCode} \n" +
                                      $"Date Check: {_log.DateCheck} \n");
                     txtProductionID.SelectAll();
                     Ultils.EditTextErrorNoMessage(txtProductionID);
                 }
             }
             else
             {
                 SetErrorStatus(true, "NG", $"Production ID[{txtProductionID.Text.Trim()}]\nChưa có trong hệ thống. Vui lòng kiểm tra lại!");
                 txtProductionID.SelectAll();
                 Ultils.EditTextErrorNoMessage(txtProductionID);
             }
         }
     }
     if (e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtProductionID.Text))
         {
             Ultils.TextControlNotNull(txtProductionID, "Production ID");
         }
     }
 }
예제 #21
0
파일: FormQACheck.cs 프로젝트: imatary/work
        private void txtBoxID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
            {
                if (string.IsNullOrEmpty(txtBoxID.Text))
                {
                    Ultils.TextControlNotNull(txtBoxID, "Box");
                }
                else
                {
                    string strBoxId = txtBoxID.Text;
                    bool   judge    = txtJudge.Text.Trim() == "1";
                    if (strBoxId.Length >= 3)
                    {
                        if (strBoxId.Substring(0, 3).ToUpper() != "F00")
                        {
                            Ultils.EditTextErrorMessage(txtBoxID, "BOX ID phải bắt đầu bằng F00");
                            txtBoxID.SelectAll();
                        }
                        else
                        {
                            var currentBox = _oqcService.CheckBoxIdExits(txtBoxID.Text.Trim());
                            if (currentBox != null)
                            {
                                //var production = _oqcService.GetLogByProductionId(txtProductionID.Text);
                                if (_log.BoxID == txtBoxID.Text.Trim())
                                {
                                    string tmp           = lblQuantityModel.Text.Replace("/", "");
                                    int    countPcbInBox = int.Parse(lblCountPCB.Text);
                                    int    quantity      = int.Parse(tmp);

                                    //if (countPcbInBox == quantity)
                                    //{
                                    //    SetErrorStatus(true, "OK", "Thùng đã được kiểm tra xong. Vui lòng\nkiểm tra thùng khác!");
                                    //    txtProductionID.Focus();
                                    //    ResetControls();
                                    //}
                                    //else
                                    //{
                                    try
                                    {
                                        _oqcService.UpdateOQCCheck(_log, Program.CurrentUser.OperatorCode);
                                        if (txtJudge.Text.Trim() == "0")
                                        {
                                            _iqcService.UpdateResult(_log.ProductionID, Program.CurrentUser.OperationID, judge, Program.CurrentUser.OperatorCode);
                                        }
                                        var logs = _oqcService.GetLogsByBoxId(txtBoxID.Text.Trim()).Where(l => l.QA_Check);
                                        gridControlData.DataSource = logs;
                                        lblCountPCB.Text           = logs.Count().ToString();
                                        SetSuccessStatus(true, "OK", "Thành công!");
                                        ResetControls();
                                    }
                                    catch (Exception ex)
                                    {
                                        SetErrorStatus(true, "NG", $"Error update!\n {ex.Message}");
                                        txtBoxID.SelectAll();
                                        Ultils.EditTextErrorNoMessage(txtBoxID);
                                    }
                                    //}
                                }
                                else
                                {
                                    SetErrorStatus(true, "NG",
                                                   $"PCB [{txtProductionID.Text}] không nằm\ntrong Box: {txtBoxID.Text} này.\n" +
                                                   "Vui lòng kiểm tra lại.");
                                    txtBoxID.SelectAll();
                                    Ultils.EditTextErrorNoMessage(txtBoxID);
                                }
                            }
                            else
                            {
                                SetErrorStatus(true, "NG",
                                               $"Box [{txtBoxID.Text}] không tồn tại trong hệ thống.\n" +
                                               "Vui lòng kiểm tra lại.");
                                txtBoxID.SelectAll();
                                Ultils.EditTextErrorNoMessage(txtBoxID);
                            }
                        }
                    }
                    else
                    {
                        Ultils.EditTextErrorMessage(txtBoxID, "BOX ID không đúng!");
                        txtBoxID.SelectAll();
                    }
                }
            }
        }