Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="line"></param>
 /// <returns></returns>
 public bool Delete(tbl_test_result entity)
 {
     using (var connection = GetOpenConnection())
     {
         try
         {
             connection.Delete <tbl_test_result>(entity);
             return(true);
         }
         catch (Exception ex)
         {
             return(false);
         }
     }
 }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool Insert(tbl_test_result entity)
 {
     using (var connection = GetOpenConnection())
     {
         try
         {
             connection.Insert <string>(entity);
             return(true);
         }
         catch (Exception ex)
         {
             return(false);
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// Insert Log
        /// </summary>
        /// <param name="boxId"></param>
        private void InsertLog(string boxId, string boardNo)
        {
            int    lineId      = Program.CurrentUser.LineID;
            int    operationId = Program.CurrentUser.OperationID;
            string operatorId  = Program.CurrentUser.OperatorCode;

            string status = null;
            bool   judge  = false;

            if (checkOK.Checked == true)
            {
                status = "P";
                judge  = true;
            }
            if (checkNG.Checked == true)
            {
                status = "F";
                judge  = false;
            }
            var logs = testLogService.Get(boxId);

            if (operationId == 1)
            {
                try
                {
                    var testLog = new tbl_test_log()
                    {
                        ProductionID = boardNo,
                        LineID       = lineId,
                        MacAddress   = txtMacAddress.Text.Trim(),
                        BoxID        = boxId,
                        DateCheck    = DateTimeServer.Date,
                        TimeCheck    = DateTimeServer.TimeOfDay,
                        OperatorCode = operatorId,
                        Target       = 1,
                        Actual       = 1,
                        FullBox      = false,
                        QA_Check     = false,
                        CheckBy      = operatorId,
                        ModelID      = _model.ModelID,
                    };

                    if (testLogService.Insert(testLog) == true)
                    {
                        var checkExists = testResultService.GetSingle(boardNo, operationId);

                        if (checkExists == null)
                        {
                            var result = new tbl_test_result()
                            {
                                ProductionID  = boardNo,
                                OperationID   = operationId,
                                OperationDate = DateTimeServer,
                                OperatorID    = operatorId,
                                JudgeResult   = judge,
                            };
                            testResultService.Insert(result);
                        }
                        else
                        {
                            checkExists.JudgeResult   = judge;
                            checkExists.OperatorID    = operatorId;
                            checkExists.OperationDate = DateTimeServer;

                            testResultService.Update(checkExists);
                        }
                    }

                    logs = testLogService.Get(boxId);
                    dataGridViewX1.DataSource = logs;

                    SuccessMessage("OK", string.Format("Thêm thành công!\nPCB [{0}]", boardNo));
                }
                catch (Exception ex)
                {
                    ErrorMessage("NG", "Error Insert! \n" + ex.Message);
                }

                // Create log
                Ultils.CreateFileLog(_model.ModelName, boardNo, status, Program.CurrentUser.ProcessID, DateTimeServer);

                txtBarcode.ResetText();
                txtBarcode.Focus();

                sw.Stop();
                MessageBox.Show(sw.Elapsed.ToString());
            }
        }