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); } } }
private void gridLookUpEditModelID_EditValueChanged(object sender, EventArgs e) { GridLookUpModel_PreviewKeyDown(); Ultils.SetColorDefaultGridLookUpEdit(gridLookUpEditModelID); }
private void txtMacAddress_EditValueChanged(object sender, EventArgs e) { Ultils.SetColorDefaultTextControl(txtMacAddress); }
public bool ChangeLanguage(string languageId) { LanguageHelper.languageId = languageId; Ultils.WriteCookie("lang", languageId); return(true); }
/// <summary> /// Get all PCB in Box /// </summary> private void GetAll(string boxId) { if (!_iqcService.CheckBoxExits(boxId)) { splashScreenManager1.ShowWaitForm(); var logs = _oqcService.GetLogsByBoxId(boxId).ToList(); if (logs.Any()) { foreach (var log in logs) { var shipping = new Shipping() { Operator = txtOperatorCode.Text, Model = gridLookUpEditModelID.Text, WorkingOder = txtWorkingOrder.Text, Quantity = 1, BoxID = txtBoxID.Text, ProductID = log.ProductionID, PO_NO = txtPO.Text, MacAddress = log.MacAddress, DateCheck = DateTime.Now.Date }; if (_iqcService.GetShippingById(log.ProductionID) == null) { if (CheckModels(shipping.ProductID)) { _shippings.Add(shipping); } else { _pcbError.Add(shipping); } } else { MessageBoxHelper.ShowMessageBoxError($"{log.ProductionID} đã được xuất trước đó. Vui lòng kiểm tra lại!"); txtBoxID.Focus(); break; } } if (_pcbError.Any()) { gridControlData.DataSource = _shippings; splashScreenManager1.CloseWaitForm(); MessageBoxHelper.ShowMessageBoxError($"Box [{boxId}] có {logs.Count} PCB\n" + $"Có {_pcbError.Count} PCB không dành cho Model [{gridLookUpEditModelID.Text}].\n" + "Vui lòng kiểm tra lại!"); //EnableTextControls(false); //VisibleControlAddPcb(true); txtBoxID.SelectAll(); txtBoxID.Focus(); } else { GetQtyPoAndRemainsByWorkingOderAndPoNo(gridLookUpEditModelID.EditValue.ToString(), txtPO.EditValue.ToString()); lblCountPCB.Text = _shippings.Count.ToString(CultureInfo.InvariantCulture); lblRemains.Text = (_currentPo.QuantityRemain - _shippings.Count).ToString(CultureInfo.InvariantCulture); Thread.Sleep(200); // Nếu số lượng đủ thì thực hiện lưu vào csdl if (_shippings.Count == _currentModel.Quantity) { gridControlData.DataSource = _shippings; splashScreenManager1.CloseWaitForm(); splashScreenManager2.ShowWaitForm(); foreach (var log in _shippings) { _iqcService.InsertShipping(txtOperatorCode.Text, gridLookUpEditModelID.EditValue.ToString(), txtWorkingOrder.Text, 1, txtPO.Text, txtBoxID.Text, log.ProductID, log.MacAddress); } _iqcService.UpdateRemainsForPo(_currentPo.PO_NO, _currentPo.ModelID, int.Parse(lblRemains.Text)); splashScreenManager2.CloseWaitForm(); InsertOrUpdatePo(gridLookUpEditModelID.EditValue.ToString(), gridLookUpEditModelID.Text, txtPO.Text); gridControlData.DataSource = null; _shippings = new List <Shipping>(); txtBoxID.Text = string.Empty; lblCountPCB.Text = @"0"; } else { if (_shippings.Count > _currentModel.Quantity) { int count = _shippings.Count - _currentModel.Quantity; gridControlData.Refresh(); gridControlData.DataSource = _shippings; splashScreenManager1.CloseWaitForm(); MessageBoxHelper.ShowMessageBoxError($"Vui lòng kiểm tra lại Box [{boxId}]\n." + $"Số lượng lớn hơn quy định {count} PCB!"); txtBoxID.SelectAll(); } else { gridControlData.Refresh(); gridControlData.DataSource = _shippings; splashScreenManager1.CloseWaitForm(); MessageBoxHelper.ShowMessageBoxWaring($"Số lượng trong Box [{boxId}] chưa đủ. Vui lòng nhập thêm!"); VisibleControlAddPcb(true); EnableTextControls(false); } } } } else { splashScreenManager1.CloseWaitForm(); if (XtraMessageBox.Show("Vui lòng bắn từng PCB vào Box [" + boxId + "]!", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { EnableTextControls(false); VisibleControlAddPcb(true); txtAddPCB.Focus(); } else { DialogResult = DialogResult.No; txtBoxID.SelectAll(); } } } else { Ultils.EditTextErrorMessage(txtBoxID, $"Box [{boxId}] đã được nhập trước đó. Vui lòng kiểm tra lại!"); txtBoxID.Text = string.Empty; } }
private void txtModel_Validating(object sender, System.ComponentModel.CancelEventArgs e) { if (string.IsNullOrEmpty(txtModel.Text)) { Ultils.TextControlNotNull(txtModel, "Model"); } else if (string.IsNullOrEmpty(txtPO.Text)) { Ultils.TextControlNotNull(txtPO, "PO"); } else { string input = txtModel.Text.Trim(); string po_no = txtPO.Text.Trim(); if (input.Length > 6 && input.Substring(0, 3) == "3N4") { input = input.Remove(0, 3); string[] array = input.Split(separator: new[] { " " }, count: 4, options: StringSplitOptions.None); string model = $"{array[0]} {array[1]}"; _currentModel = _modelService.GetModelByName(model, FujiXerox); if (_currentModel != null) { int quantity = 0; if (checkFujiHP.Checked == true) { if ((_currentModel.ModelName == "105K 33480") || (_currentModel.ModelName == "105K 33470")) { quantity = _currentModel.QuantityHP; } else { MessageBoxHelper.ShowMessageBoxError("Vui lòng kiểm tra lại Models!"); checkFujiHP.Checked = false; } } else { quantity = _currentModel.Quantity; } lblQuantityModel.Text = $"/{quantity}"; if (!string.IsNullOrEmpty(po_no)) { if (!GetQtyPoAndRemainsByWorkingOderAndPoNo(_currentModel.ModelID, po_no)) { _iqcService.InsertPo(_currentModel.ModelID, po_no, quantityPO, txtOperatorCode.Text); GetQtyPoAndRemainsByWorkingOderAndPoNo(_currentModel.ModelID, po_no); } else { InsertOrUpdatePo(_currentModel.ModelID, model, po_no); } txtModel.Text = model; txtBoxID.Focus(); } else { Ultils.EditTextErrorMessage(txtModel, "PO NO không được để trống. Vui lòng bắn nhập vào PO NO!"); } } else { Ultils.EditTextErrorMessage(txtModel, "Model không tồn tại. Vui lòng kiểm tra lại!"); txtModel.ResetText(); txtModel.Focus(); } } else { Ultils.EditTextErrorMessage(txtModel, "Model không đúng định dạng. Vui lòng bắn lại!"); } } }
private void OnChanged(object sender, FileSystemEventArgs e) { if (!m_bDirty) { if (e.ChangeType == WatcherChangeTypes.Deleted || e.ChangeType == WatcherChangeTypes.Renamed) { return; } else { if (e.FullPath.Contains("Shanks_IB02")) { // DO SOMETING LIKE MOVE, COPY, ETC bool exists = Directory.Exists(backup_log_folder); if (!exists) { Directory.CreateDirectory(backup_log_folder); } string fullPath = backup_log_folder + e.Name; if (File.Exists(fullPath)) { File.Delete(fullPath); Thread.Sleep(1000); File.Copy(e.FullPath, fullPath); var data = Ultils.ReadLogTxt(fullPath).LastOrDefault(); if (data == "FAIL") { _status = "F"; boardState = "FAILD"; ng = ng + 1; } else if (data == "PASS") { _status = "P"; boardState = "OK"; pass = pass + 1; // Đóng dấu tự động if (checkComWrite.Checked == true) { comWrite.WriteData("A"); } } total = pass + ng; Ultils.CreateFileLog(modelId, productionId, _status, gridLookUpEditProcessID.EditValue.ToString(), dateCheck); } else { Thread.Sleep(1000); File.Copy(e.FullPath, fullPath); var data = Ultils.ReadLogTxt(fullPath).LastOrDefault(); if (data == "FAIL") { _status = "F"; boardState = "FAILD"; ng = ng + 1; } else if (data == "PASS") { _status = "P"; boardState = "OK"; pass = pass + 1; } total = pass + ng; Ultils.CreateFileLog(modelId, productionId, _status, gridLookUpEditProcessID.EditValue.ToString(), dateCheck); } } else { return; } } m_bDirty = true; } }
private void SearchPCB(string productionId) { splashScreenManager2.ShowWaitForm(); if (string.IsNullOrEmpty(productionId)) { splashScreenManager2.CloseWaitForm(); Ultils.TextControlNotNull(txtSearchPCB, "Nhập vào từ khóa cần tìm!"); txtSearchPCB.SelectAll(); } else { if (comboBoxEditSearchByKey.EditValue.Equals("Production ID")) { var logs = _iqcService.GetLogsById(productionId); if (logs != null) { gridControlData.DataSource = _iqcService.GetLogsById(productionId); splashScreenManager2.CloseWaitForm(); //if (EnableUpdateOrDelete(true)) //{ // EnableSearch(false); // txtBoxID.Focus(); //} //else //{ // MessageBox.Show("False"); //} } else { splashScreenManager2.CloseWaitForm(); MessageBoxHelper.ShowMessageBoxWaring($"Không tìm thấy PCB nào với Production ID [{productionId}]"); txtSearchPCB.SelectAll(); txtSearchPCB.Focus(); } } else if (comboBoxEditSearchByKey.EditValue.Equals("Box ID")) { string strLength = txtSearchPCB.Text; if (strLength.Length >= 3) { if (strLength.Substring(0, 3).ToUpper() != "F00") { splashScreenManager2.CloseWaitForm(); Ultils.EditTextErrorMessage(txtSearchPCB, "BOX ID phải bắt đầu bằng F00"); txtSearchPCB.SelectAll(); } else { var logs = _iqcService.GetLogs().Where(p => p.BoxID == productionId).ToList(); if (logs.Any()) { gridControlData.DataSource = logs; splashScreenManager2.CloseWaitForm(); //if (EnableUpdateOrDelete(true)) //{ // EnableSearch(false); // txtBoxID.Focus(); //} //else //{ // MessageBox.Show("False"); //} } else { splashScreenManager2.CloseWaitForm(); MessageBoxHelper.ShowMessageBoxWaring($"Không tìm thấy PCB nào trong Box [{productionId}]"); txtSearchPCB.SelectAll(); txtSearchPCB.Focus(); } } } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnChanged(object sender, FileSystemEventArgs e) { if (!_mBDirty) { if (e.ChangeType == WatcherChangeTypes.Deleted || e.ChangeType == WatcherChangeTypes.Renamed) { return; } else { if (e.FullPath.Contains("Mango_CTMS")) { // DO SOMETING LIKE MOVE, COPY, ETC bool exists = Directory.Exists(backup_log_folder); if (!exists) { Directory.CreateDirectory(backup_log_folder); } string fullPath = backup_log_folder + e.Name; if (File.Exists(fullPath)) { File.Delete(fullPath); Thread.Sleep(1000); File.Copy(e.FullPath, fullPath); var data = Ultils.ReadLogTxt(fullPath).LastOrDefault(); if (data == "FAIL") { _status = "F"; _boardState = "FAILD"; _ng = _ng + 1; } else if (data == "PASS") { _status = "P"; _boardState = "OK"; _pass = _pass + 1; } _total = _pass + _ng; Ultils.CreateFileLog(_modelId, _productionId, _status, gridLookUpEditProcessID.EditValue.ToString(), _dateCheck); } else { Thread.Sleep(1000); File.Copy(e.FullPath, fullPath); var data = Ultils.ReadLogTxt(fullPath).LastOrDefault(); if (data == "FAIL") { _status = "F"; _boardState = "FAILD"; _ng = _ng + 1; } else if (data == "PASS") { _status = "P"; _boardState = "OK"; _pass = _pass + 1; } _total = _pass + _ng; Ultils.CreateFileLog(_modelId, _productionId, _status, gridLookUpEditProcessID.EditValue.ToString(), _dateCheck); } } else { return; } } _mBDirty = true; } }
private void btnExportToCSV_Click(object sender, EventArgs e) { bool exists = Directory.Exists(pathLog); if (!exists) { Directory.CreateDirectory(pathLog); } // Log system // Log Print system string logPrint = txtPathLog.Text; if (!Directory.Exists(logPrint)) { Directory.CreateDirectory(logPrint); } string folderModel = $@"{pathLog}\{_model.Name}"; if (!Directory.Exists(folderModel)) { Directory.CreateDirectory(folderModel); } string year = cboYear.Text; string month = cboMonth.Text; string fileName = $@"{folderModel}\{year + month}.csv"; if (!File.Exists(fileName)) { File.Create(fileName).Dispose(); } // Logs string newLog = logPrint + @"\Log.csv"; if (!File.Exists(newLog)) { File.Create(newLog).Dispose(); } try { Ultils.WriteCSV(dataGridView1, fileName); Ultils.WriteAppendCSV(dataGridView1, true, newLog); MessageBox.Show("Export success!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); txtQuantity.ResetText(); txtCode.ResetText(); cboModels.ResetText(); dataGridView1.DataSource = null; dataGridView1.Refresh(); } catch (Exception ex) { MessageBox.Show($"Error:\n{ex.Message}", "Success", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnExportToCSV_Click(object sender, EventArgs e) { if (pathLog == null || pathLog == "") { MessageBox.Show("Please select the path to save the log file!", "Error path logs", MessageBoxButtons.OK, MessageBoxIcon.Error); FieldError(txtPathLog); return; } bool exists = Directory.Exists(pathLog); if (!exists) { Directory.CreateDirectory(pathLog); } // Log Print system string logPrint = pathLog; if (!Directory.Exists(logPrint)) { Directory.CreateDirectory(logPrint); } string folderModel = $@"{pathLog}\{_model.Model}"; if (!Directory.Exists(folderModel)) { Directory.CreateDirectory(folderModel); } string fileName = $@"{folderModel}\{_model.Model}.csv"; //string fileName = $@"{pathLog}\{_model.Name + year + month}.csv"; if (!File.Exists(fileName)) { File.Create(fileName).Dispose(); } // Logs string newLog = logPrint + @"\Log.csv"; if (!File.Exists(newLog)) { File.Create(newLog).Dispose(); } try { Ultils.WriteCSV(dataGridView1, fileName); Ultils.WriteAppendCSV(dataGridView1, true, newLog); MessageBox.Show("Export success!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); txtQuantity.ResetText(); cboModels.ResetText(); txtASSYNo.ResetText(); dataGridView1.DataSource = null; dataGridView1.Refresh(); } catch (Exception ex) { MessageBox.Show($"Error:\n{ex.Message}", "Success", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void PrintCharacter(CharacterProperties character) { Console.WriteLine(Ultils.FormatText(character.id.ToString(), 10) + Ultils.FormatText(character.characterName, 25) + Ultils.FormatText(character.hp.ToString()) + Ultils.FormatText(character.mp.ToString())); }
/// <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(); } }
/// <summary> /// Chờ sự thay đổi trong folder /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnChanged(object sender, FileSystemEventArgs e) { if (!m_bDirty) { if (e.ChangeType == WatcherChangeTypes.Deleted || e.ChangeType == WatcherChangeTypes.Renamed) { return; } else { // DO SOMETING LIKE MOVE, COPY, ETC bool exists = Directory.Exists(backup_log_folder); if (!exists) { Directory.CreateDirectory(backup_log_folder); } string fullPath = backup_log_folder + e.Name; if (File.Exists(fullPath)) { File.Delete(fullPath); Thread.Sleep(5000); File.Copy(e.FullPath, fullPath); Thread.Sleep(5000); var data = Ultils.ReadCsv(e.FullPath).Skip(1); // skip 1 headerlines string[] _array = data.LastOrDefault(); if (string.IsNullOrEmpty(_array[3])) { return; } if (string.IsNullOrEmpty(_array[5])) { return; } if (_array[3] == "OK") { _status = "P"; boardState = "OK"; pass = pass + 1; if (checkComWrite.Checked == true) { comWrite.WriteData("A"); } } if (_array[3] == "NG") { _status = "F"; boardState = "FAILD"; ng = ng + 1; } total = pass + ng; Ultils.CreateFileLog(modelId, productionId, _status, gridLookUpEditProcessID.EditValue.ToString(), dateCheck); StartTimerReadBarcode(); } else { Thread.Sleep(5000); File.Copy(e.FullPath, fullPath); Thread.Sleep(5000); var data = Ultils.ReadCsv(e.FullPath).Skip(1); // skip 1 headerlines string[] _array = data.LastOrDefault(); if (string.IsNullOrEmpty(_array[3])) { return; } if (string.IsNullOrEmpty(_array[5])) { return; } if (_array[3] == "OK") { _status = "P"; boardState = "OK"; pass = pass + 1; } if (_array[3] == "NG") { _status = "F"; boardState = "FAILD"; ng = ng + 1; } string stationNo = gridLookUpEditProcessID.EditValue.ToString(); total = pass + ng; Ultils.CreateFileLog(modelId, productionId, _status, stationNo, dateCheck); StartTimerReadBarcode(); } } m_bDirty = true; } }
public void PrintListSkill() { Console.WriteLine(Ultils.FormatText(MyLocalization.GetText("ID"), 10) + Ultils.FormatText(MyLocalization.GetText("Skill Name"), 25) + Ultils.FormatText(MyLocalization.GetText("Description"), 20) + Ultils.FormatText(MyLocalization.GetText("Magic Value")) + Ultils.FormatText(MyLocalization.GetText("Time Cool Down")) + Ultils.FormatText(MyLocalization.GetText("MP Used"), 10) + "\n"); foreach (var item in skillManager.GetList()) { PrintSkill(item.Value); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtBarcode_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Enter) { string boardNo = txtBarcode.Text; _dateCheck = Ultils.GetNetworkDateTime().ToString("yyMMddHHmmss") != "" ? Ultils.GetNetworkDateTime().ToString("yyMMddHHmmss") : DateTime.Now.ToString("yyMMddHHmmss"); _timeCheck = Ultils.GetNetworkDateTime().ToShortTimeString() != "" ? Ultils.GetNetworkDateTime().ToShortTimeString() : DateTime.Now.ToShortTimeString(); if (boardNo.Contains("=")) { boardNo = boardNo.Replace("=", "_"); } string setStationNo = gridLookUpEditProcessID.EditValue.ToString(); if (txtBarcode.Text.Length <= 10) { ActiveFormByWindowsTitle(cboWindows.EditValue.ToString()); } else { _scanningLogs = _scanningLogsService.Get_SCANNING_LOGS(boardNo).FirstOrDefault(); if (_scanningLogs != null) { _inspectionProcesses = _inspectionProcessesService.GET_INSPECTION_PROCESSES_BY_PRODUCT_ID(_scanningLogs.PRODUCT_ID); if (_inspectionProcesses != null) { _inspectionProcedureDesigners = _inspectionProcessesDesignersService.GET_INSPECTION_PROCEDURE_DESIGNERS_BY_PROCESS_NO(_inspectionProcesses.PROCESS_NO); //trạng thái bản mạch hiện tại _workOrderItems = _workOrderItemService.Get_WORK_ORDER_ITEMS_By_BoardNo(boardNo); if (_workOrderItems != null) { // nếu đã đã chạy qua các bước, với trạng thái là Finished // thì thông báo cho người dùng biết if (_workOrderItems.IS_FINISHED) { //CancelAsyncBackgroundWorker(); _messageError = $"Board '{boardNo}' is finished!"; MessageHelpers.SetErrorStatus(true, "NG", _messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); Reset(_messageError); } // Kiểm tra nếu trạng thái bản mạch hiện tại bị NG // mà khác với với trạm được cài đặt "FCT" thì thông báo lỗi else if (_workOrderItems.STATION_NO != setStationNo && _workOrderItems.BOARD_STATE == 2) { //CancelAsyncBackgroundWorker(); var stationName = _inspectionProcedureDesigners.FirstOrDefault(item => item.INDEX == _workOrderItems.PROCEDURE_INDEX); if (stationName != null) { _messageError = $"Board '{boardNo}' bị 'NG' tại trạm trước {stationName.STATION_NO}!"; } MessageHelpers.SetErrorStatus(true, "NG", _messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); Reset(_messageError); } // Nếu tên giống nhau, thì thông báo đã chạy qua công đoạn này rồi else if (_workOrderItems.STATION_NO == setStationNo && _workOrderItems.BOARD_STATE == 1) { Excute(boardNo, _scanningLogs.PRODUCT_ID); } else { // Set station no var processByStationNo = _inspectionProcedureDesigners.FirstOrDefault(item => item.STATION_NO == setStationNo); // Nếu trong process_Designer không có STATION_NO giống với // station_no curent thì thông báo cho người dùng biết if (processByStationNo == null) { //CancelAsyncBackgroundWorker(); _messageError = $"Board '{boardNo}' station '{setStationNo}' not invaild!"; MessageHelpers.SetErrorStatus(true, "NG", _messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); Reset(_messageError); } // nếu hợp lệ thực hiện tiếp else { // Khi hai giá trị bằng nhau => ICT_FUJ if (_workOrderItems.PROCEDURE_INDEX < (processByStationNo.INDEX - 1)) { //CancelAsyncBackgroundWorker(); var stationName = _inspectionProcedureDesigners.FirstOrDefault(item => item.INDEX == _workOrderItems.PROCEDURE_INDEX); if (stationName != null) { _messageError = $"Board '{boardNo}' bỏ qua công đoạn '{stationName.STATION_NO}'!"; } MessageHelpers.SetErrorStatus(true, "NG", _messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); Reset(_messageError); //Excute(boardNo, _scanningLogs.PRODUCT_ID); } //// Nếu Index Board > Set Index else if (_workOrderItems.PROCEDURE_INDEX > processByStationNo.INDEX) { //CancelAsyncBackgroundWorker(); // transferred to the next station. var stationName = _inspectionProcedureDesigners.FirstOrDefault(item => item.INDEX == _workOrderItems.PROCEDURE_INDEX); if (stationName != null) { _messageError = $"Board '{boardNo}' chuyển đến trạm '{stationName.STATION_NO}' để chạy tiếp!"; } MessageHelpers.SetErrorStatus(true, "NG", _messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); Reset(_messageError); } else if (_workOrderItems.PROCEDURE_INDEX == (processByStationNo.INDEX - 1)) { Excute(boardNo, _scanningLogs.PRODUCT_ID); } else if (_workOrderItems.BOARD_STATE == 2) { Excute(boardNo, _scanningLogs.PRODUCT_ID); } } } } else { //CancelAsyncBackgroundWorker(); _messageError = $"Không tìm thấy trạm với tên {setStationNo}!"; MessageHelpers.SetErrorStatus(true, "NG", _messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); Reset(_messageError); } } else { //CancelAsyncBackgroundWorker(); _messageError = $"Station No '{setStationNo}' không hợp lệ!"; MessageHelpers.SetErrorStatus(true, "NG", _messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); Reset(_messageError); } } else { //CancelAsyncBackgroundWorker(); _messageError = $"Board '{boardNo}' chưa được khởi tạo. Vui lòng kiểm tra lại!"; MessageHelpers.SetErrorStatus(true, "NG", _messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); Reset(_messageError); } } } }
public void PrintSkill(SkillData skill) { Console.WriteLine("\n" + Ultils.FormatText(skill.id.ToString(), 10) + Ultils.FormatText(skill.skillName, 25) + Ultils.FormatText(skill.description, 20) + Ultils.FormatText(skill.timeUsed.ToString()) + Ultils.FormatText(skill.timeCooldown.ToString()) + Ultils.FormatText(skill.mpUsed.ToString())); Console.WriteLine(MyLocalization.GetText("Skill Effect")); PrintEffectOfSKill(skill); }
private void SearchPCB(string searchKey) { splashScreenManager2.ShowWaitForm(); if (string.IsNullOrEmpty(searchKey)) { splashScreenManager2.CloseWaitForm(); Ultils.TextControlNotNull(txtSearchPCB, "Nhập vào từ khóa cần tìm!"); txtSearchPCB.SelectAll(); } else { if (comboBoxEditSearchByKey.EditValue.Equals("Production ID")) { var logs = _oqcService.GetLogsById(searchKey); var list = new List <tbl_test_log>(); if (logs != null) { list.Add(logs); gridControlData.DataSource = list; btnDelete.Enabled = true; splashScreenManager2.CloseWaitForm(); } else { splashScreenManager2.CloseWaitForm(); MessageBoxHelper.ShowMessageBoxWaring($"No results width ID:[{searchKey}]"); txtSearchPCB.SelectAll(); txtSearchPCB.Focus(); } } else if (comboBoxEditSearchByKey.EditValue.Equals("Box ID")) { string strLength = txtSearchPCB.Text; if (strLength.Length >= 3) { if (strLength.Substring(0, 3).ToUpper() != "F00") { splashScreenManager2.CloseWaitForm(); Ultils.EditTextErrorMessage(txtSearchPCB, "BOX ID phải bắt đầu bằng F00"); txtSearchPCB.SelectAll(); } else { var logs = _oqcService.GetLogsByBoxId(searchKey).ToList(); if (logs.Any()) { gridControlData.DataSource = logs; btnDelete.Enabled = true; splashScreenManager2.CloseWaitForm(); } else { splashScreenManager2.CloseWaitForm(); MessageBoxHelper.ShowMessageBoxWaring($"Không tìm thấy PCB nào trong Box [{searchKey}]"); txtSearchPCB.SelectAll(); txtSearchPCB.Focus(); } } } } } }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(gridLookUpEditStock.Text)) { Ultils.GridLookUpEditControlNotNull(gridLookUpEditStock, "Kho Hàng"); } else if (string.IsNullOrEmpty(gridLookUpEditProductGroup.Text)) { Ultils.GridLookUpEditControlNotNull(gridLookUpEditProductGroup, "Nhóm Hàng"); } else if (string.IsNullOrEmpty(txtProductID.Text)) { Ultils.TextControlNotNull(txtProductID, "Mã Hàng"); } else if (string.IsNullOrEmpty(txtProductName.Text)) { Ultils.TextControlNotNull(txtProductName, "Tên Hàng"); } else if (string.IsNullOrEmpty(gridLookUpEditUnit.Text)) { Ultils.GridLookUpEditControlNotNull(gridLookUpEditUnit, "Đơn Vị Tính"); } else if (string.IsNullOrEmpty(txtPrice.Text)) { Ultils.TextControlNotNull(txtPrice, "Giá Nhập"); } else { if (string.IsNullOrEmpty(_productId)) { _product = new Product() { ProductID = txtProductID.Text, ProductName = txtProductName.Text, ProductGroupID = gridLookUpEditProductGroup.EditValue.ToString(), StockID = gridLookUpEditStock.EditValue.ToString(), UnitID = gridLookUpEditUnit.EditValue.ToString(), Origin = txtOrigin.Text, Barcode = string.IsNullOrEmpty(txtBarcode.Text) ? _productService.NextId() : txtBarcode.Text, //Quantity = int.Parse(txtQuantity.Text), Color = txtColor.Text, Supplier = txtSupplier.Text, Description = txtDescription.Text, Active = checkActive.Checked, CreatedDate = DateTime.Now, Price = Convert.ToInt32(txtPrice.Text), CreatedBy = Program.CurrentUser.Username, }; //if (!string.IsNullOrEmpty(gridLookUpEditColor.SelectedText)) //{ // product.ColorID = Convert.ToInt32(gridLookUpEditColor.EditValue.ToString()); //} try { _productService.Add(_product); ResetControls(); _logService.InsertLog(Program.CurrentUser.Username, "Thêm", this.Text); MessageBoxHelper.ShowMessageBoxInfo("Thêm thành công"); } catch (Exception ex) { MessageBoxHelper.ShowMessageBoxError(ex.Message); } } else { // Update _product = _productService.GetProductById(_productId); if (_product != null) { _product.ProductName = txtProductName.Text; _product.ProductGroupID = gridLookUpEditProductGroup.EditValue.ToString(); _product.StockID = gridLookUpEditStock.EditValue.ToString(); _product.UnitID = gridLookUpEditUnit.EditValue.ToString(); _product.Supplier = txtSupplier.Text; _product.Barcode = txtBarcode.Text; _product.Origin = txtOrigin.Text; //product.Quantity = int.Parse(txtQuantity.Text); _product.Description = txtDescription.Text; _product.Active = checkActive.Checked; _product.ModifyDate = DateTime.Now; _product.ModifyBy = Program.CurrentUser.Username; _product.Price = int.Parse(txtPrice.Text); //if (!string.IsNullOrEmpty(gridLookUpEditColor.SelectedText)) //{ // product.ColorID = Convert.ToInt32(gridLookUpEditColor.EditValue.ToString()); //} } try { _productService.Update(_product); _logService.InsertLog(Program.CurrentUser.Username, "Sửa", this.Text); MessageBoxHelper.ShowMessageBoxInfo("Sửa thành công!"); this.Dispose(); } catch (Exception ex) { MessageBoxHelper.ShowMessageBoxError(ex.Message); } } } }
public void PrintListSkillEffect() { Console.WriteLine("\n" + Ultils.FormatText(MyLocalization.GetText("ID"), 10) + Ultils.FormatText(MyLocalization.GetText("Type Action"), 30) + Ultils.FormatText(MyLocalization.GetText("Type Effect"), 30) + Ultils.FormatText(MyLocalization.GetText("Level Skill Effect")) + Ultils.FormatText(MyLocalization.GetText("Effect Value")) + Ultils.FormatText(MyLocalization.GetText("Time Exist")) + Ultils.FormatText(MyLocalization.GetText("Ratio Success")) + Ultils.FormatText(MyLocalization.GetText("Time Distance")) + Ultils.FormatText(MyLocalization.GetText("Ratio Outbreak")) + "\n"); foreach (var item in skillEffectManager.GetListSkillEffect()) { PrintSkillEffect(item.Value); } }
private void txtBarcode_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Enter) { string boardNo = txtBarcode.Text; dateCheck = Ultils.GetNetworkDateTime().ToString("yyMMddHHmmss"); if (boardNo.Contains("=")) { boardNo = boardNo.Replace("=", "_"); } string set_station_no = gridLookUpEditProcessID.EditValue.ToString(); if (!CheckTextBoxNullValue.ValidationTextEditNullValue(txtBarcode)) { MessageHelpers.SetErrorStatus(true, "NG", "Please input a barcode!", lblStatus, lblMessage); startRead = false; return; } else if (txtBarcode.Text.Length <= 5) { MessageHelpers.SetErrorStatus(true, "NG", $"Board No {boardNo} invaild. Please try again!", lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); startRead = false; return; } else { MessageHelpers.SetDefaultStatus(true, "N/A", "N/A", lblStatus, lblMessage); CheckTextBoxNullValue.SetColorDefaultTextControl(txtBarcode); var boards = _scanningLogsService.Get_SCANNING_LOGS(boardNo).FirstOrDefault(); if (boards != null) { var process_No = _inspectionProcessesService.GET_INSPECTION_PROCESSES_BY_PRODUCT_ID(boards.PRODUCT_ID); if (process_No != null) { // //trạng thái bản mạch hiện tại var curentStationNo = _workOrderItemService.Get_WORK_ORDER_ITEMS_By_BoardNo(boardNo); if (curentStationNo != null) { // nếu đã đã chạy qua các bước, với trạng thái là Finished // thì thông báo cho người dùng biết if (curentStationNo.IS_FINISHED == true) { messageError = $"Board '{boardNo}' is finished!"; MessageHelpers.SetErrorStatus(true, "NG", messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); startRead = false; var errorForm = new FormError(messageError); errorForm.ShowDialog(); txtBarcode.Focus(); } // Kiểm tra nếu trạng thái bản mạch hiện tại bị NG // mà khác với với trạm được cài đặt "FCT" thì thông báo lỗi else if (curentStationNo.STATION_NO != set_station_no && curentStationNo.BOARD_STATE == 2) { messageError = $"Board '{boardNo}' bị 'NG' tại trạm '{set_station_no}'!"; MessageHelpers.SetErrorStatus(true, "NG", messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); startRead = false; var errorForm = new FormError(messageError); errorForm.ShowDialog(); txtBarcode.Focus(); } // Nếu tên giống nhau, thì thông báo đã chạy qua công đoạn này rồi else if (curentStationNo.STATION_NO == set_station_no && curentStationNo.BOARD_STATE == 1) { Excute(boardNo, boards.PRODUCT_ID); } else { var process_Designer = _inspectionProcessesDesignersService.GET_INSPECTION_PROCEDURE_DESIGNERS_BY_PROCESS_NO(process_No.PROCESS_NO); // Set station no var process_by_station_no = process_Designer.FirstOrDefault(item => item.STATION_NO == set_station_no); // Nếu trong process_Designer không có STATION_NO giống với // station_no curent thì thông báo cho người dùng biết if (process_by_station_no == null) { messageError = $"Board '{boardNo}' station '{set_station_no}' not invaild!"; MessageHelpers.SetErrorStatus(true, "NG", messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); startRead = false; var errorForm = new FormError(messageError); errorForm.ShowDialog(); txtBarcode.Focus(); } // nếu hợp lệ thực hiện tiếp else { // Khi hai giá trị bằng nhau => ICT_FUJ if (curentStationNo.PROCEDURE_INDEX < (process_by_station_no.INDEX - 1)) { messageError = $"Board '{boardNo}' skip stations!"; MessageHelpers.SetErrorStatus(true, "NG", messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); startRead = false; var errorForm = new FormError(messageError); errorForm.ShowDialog(); txtBarcode.Focus(); return; } //// Nếu Index Board > Set Index else if (curentStationNo.PROCEDURE_INDEX > process_by_station_no.INDEX) { // transferred to the next station. messageError = $"Board '{boardNo}' transferred to the next station!"; MessageHelpers.SetErrorStatus(true, "NG", messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); startRead = false; var errorForm = new FormError(messageError); errorForm.ShowDialog(); txtBarcode.Focus(); return; } else if (curentStationNo.PROCEDURE_INDEX == (process_by_station_no.INDEX - 1)) { Excute(boardNo, boards.PRODUCT_ID); } else if (curentStationNo.BOARD_STATE == 2) { Excute(boardNo, boards.PRODUCT_ID); } } } } else { messageError = $"Station No '{curentStationNo.STATION_NO}' not found!"; MessageHelpers.SetErrorStatus(true, "NG", messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); var errorForm = new FormError(messageError); errorForm.ShowDialog(); txtBarcode.Focus(); return; } } else { messageError = $"Station No '{set_station_no}' invaild!"; MessageHelpers.SetErrorStatus(true, "NG", messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); var errorForm = new FormError(messageError); errorForm.ShowDialog(); txtBarcode.Focus(); } } else { messageError = $"Board '{boardNo}' not initialized!"; MessageHelpers.SetErrorStatus(true, "NG", messageError, lblStatus, lblMessage); CheckTextBoxNullValue.SetColorErrorTextControl(txtBarcode); var errorForm = new FormError(messageError); errorForm.ShowDialog(); txtBarcode.Focus(); } } } }
public void PrintSkillEffect(SkillEffectData skillEffect) { Console.WriteLine(Ultils.FormatText(skillEffect.id.ToString(), 10) + Ultils.FormatText(skillEffect.typeAction.ToString(), 30) + Ultils.FormatText(skillEffect.typeEffect.ToString(), 30) + Ultils.FormatText(skillEffect.levelSkillEffect.ToString()) + Ultils.FormatText(skillEffect.effectValue.ToString()) + Ultils.FormatText(skillEffect.timeExist.ToString()) + Ultils.FormatText(skillEffect.ratioSuccess.ToString()) + Ultils.FormatText(skillEffect.timeDistance.ToString()) + Ultils.FormatText(skillEffect.ratioOutbreak.ToString()) + "\n"); }
/// <summary> /// Insert Log /// </summary> /// <param name="boxId"></param> private void InsertLog(string boxId) { if (!string.IsNullOrEmpty(txtProductID.Text.Trim()) || !string.IsNullOrEmpty(txtBoxID.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 = _oqcService.GetLogsByBoxId(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) { //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); // txtProductID.ResetText(); //} //else //{ try { _iqcService.InsertLogs(productionId, lineId, "N/A", boxId, modelID, "N/T", 1, operatorId, false, "IT", StringHelper.GetInfo(), "N/A"); 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 = _oqcService.GetLogsByBoxId(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); // 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(); } //} } // 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(), "N/A"); 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 = _oqcService.GetLogsByBoxId(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, "N/A"); _iqcService.InsertResult(productionId, operationId, judge, operatorId, _dateTimeCheck); logs = _oqcService.GetLogsByBoxId(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!"); txtProductID.Focus(); txtProductID.SelectAll(); } }
public static NGUOILX_HOSO_DB copyData(NGUOILX_HOSO data) { NGUOILX_HOSO_DB obj = new NGUOILX_HOSO_DB(); obj.MADK = Ultils.NullValue(data.MADK); obj.SOHOSO = Ultils.NullValue(data.SOHOSO); obj.MACSDT = Ultils.NullValue(data.MACSDT); obj.MASOGTVT = Ultils.NullValue(data.MASOGTVT); obj.MADVNHANHSO = Ultils.NullValue(data.MADVNHANHSO); obj.NGAYNHANHSO = Ultils.NullValueDate(data.NGAYNHANHSO); obj.NGAYHENTRA = Ultils.NullValueDate(data.NGAYHENTRA); obj.MALOAIHS = Ultils.NullValueInt(data.MALOAIHS); obj.TT_XULY = Ultils.NullValue(data.TT_XULY); obj.DUONGDANANH = Ultils.NullValue(data.DUONGDANANH); obj.CHATLUONGANH = Ultils.NullValueInt(data.CHATLUONGANH); obj.NGAYTHUNHANANH = Ultils.NullValueDate(data.NGAYTHUNHANANH); obj.NGUOITHUNHANANH = Ultils.NullValue(data.NGUOITHUNHANANH); obj.SOGPLXDACO = Ultils.NullValue(data.SOGPLXDACO); obj.HANGGPLXDACO = Ultils.NullValue(data.HANGGPLXDACO); obj.DONVICAPGPLXDACO = Ultils.NullValue(data.DONVICAPGPLXDACO); obj.NOICAPGPLXDACO = Ultils.NullValue(data.NOICAPGPLXDACO); obj.NGAYCAPGPLXDACO = Ultils.NullValue(data.NGAYCAPGPLXDACO); obj.NGAYHHGPLXDACO = Ultils.NullValue(data.NGAYHHGPLXDACO); obj.NGAYTTGPLXDACO = Ultils.NullValue(data.NGAYTTGPLXDACO); obj.DONVIHOCLX = Ultils.NullValue(data.DONVIHOCLX); obj.NAMHOCLX = Ultils.NullValueInt(data.NAMHOCLX); obj.HANGGPLX = Ultils.NullValue(data.HANGGPLX); obj.SONAMLX = Ultils.NullValueInt(data.SONAMLX); obj.SOKMLXANTOAN = Ultils.NullValueInt(data.SOKMLXANTOAN); obj.GIAYCNSK = Ultils.NullValueBool(data.GIAYCNSK); obj.LYDOCAPDOI = Ultils.NullValue(data.LYDOCAPDOI); obj.MUCDICHCAPDOI = Ultils.NullValue(data.MUCDICHCAPDOI); obj.NOIDUNGSH = Ultils.NullValueInt(data.NOIDUNGSH); obj.MAKHOAHOC = Ultils.NullValue(data.MAKHOAHOC); obj.HANGDAOTAO = Ultils.NullValue(data.HANGDAOTAO); obj.SOGIAYCNTN = Ultils.NullValue(data.SOGIAYCNTN); obj.SoCCN = Ultils.NullValue(data.SOCCN); obj.MABC1 = Ultils.NullValue(data.MABC1); obj.BC1_TUOITS = Ultils.NullValueBool(data.BC1_TUOITS); obj.BC1_THAMNIEN = Ultils.NullValueBool(data.BC1_THAMNIEN); obj.MABC2 = Ultils.NullValue(data.MABC2); obj.KETQUABC2 = Ultils.NullValueBool(data.KETQUABC2); obj.MALYDOTCBC2 = Ultils.NullValueInt(data.MALYDOTCBC2); obj.MAKYSH = Ultils.NullValue(data.MAKYSH); obj.SOBD = Ultils.NullValue(data.SOBD); obj.LANSH = Ultils.NullValueInt(data.LANSH); obj.SOQDSH = Ultils.NullValue(data.SOQDSH); obj.NGAYQDSH = Ultils.NullValueDate(data.NGAYQDSH); obj.KETQUA_LYTHUYET = Ultils.NullValueInt(data.KETQUA_LYTHUYET); obj.NHANXET_LYTHUYET = Ultils.NullValue(data.NHANXET_LYTHUYET); obj.KETQUA_HINH = Ultils.NullValueInt(data.KETQUA_HINH); obj.NHANXET_HINH = Ultils.NullValue(data.NHANXET_HINH); obj.KETQUA_DUONG = Ultils.NullValueInt(data.KETQUA_DUONG); obj.NHANXET_DUONG = Ultils.NullValue(data.NHANXET_DUONG); obj.KETQUASH = Ultils.NullValue(data.KETQUASH); obj.SOQDTT = Ultils.NullValue(data.SOQDTT); obj.NGAYQDTT = Ultils.NullValueDate(data.NGAYQDTT); obj.NGUOIKY = Ultils.NullValue(data.NGUOIKY); obj.GHICHU = Ultils.NullValue(data.GHICHU); obj.NGUOITAO = Ultils.NullValue(data.NGUOITAO); obj.NGUOISUA = Ultils.NullValue(data.NGUOISUA); obj.NGAYTAO = Ultils.NullValueDate(data.NGAYTAO); obj.NGAYSUA = Ultils.NullValueDate(data.NGAYSUA); obj.SOGPLXTMP = Ultils.NullValue(data.SOGPLXTMP); obj.NGAYKTBC1 = Ultils.NullValueDate(data.NGAYKTBC1); obj.NGUOIKTBC1 = Ultils.NullValue(data.NGUOIKTBC1); obj.NGAYKTBC2 = Ultils.NullValueDate(data.NGAYKTBC2); obj.NGUOIKTBC2 = Ultils.NullValue(data.NGUOIKTBC2); obj.MAIN = Ultils.NullValue(data.MAIN); obj.KETQUADOISANHTW = Ultils.NullValueBool(data.KETQUADOISANHTW); obj.GHICHUKQDSTW = Ultils.NullValue(data.GHICHUKQDSTW); obj.CHUKY = Ultils.NullValue(data.CHUKY); obj.TRANGTHAI = Ultils.NullValueBool(data.TRANGTHAI); obj.MAHTCAP = Ultils.NullValue(data.MAHTCAP); if (data.IDS == null) { obj.IDS = null; } else { obj.IDS = Int64.Parse(data.IDS.ToString()); } obj.TT_XULY_OLD = Ultils.NullValue(data.TT_XULY_OLD); obj.KQ_BC1 = Ultils.NullValueBool(data.KQ_BC1); obj.KQ_BC1_GHICHU = Ultils.NullValue(data.KQ_BC1_GHICHU); obj.TRANSFER_FLAG = Ultils.NullValueInt(data.TRANSFER_FLAG); obj.NAMCAPLANDAU = Ultils.NullValue(data.NAMCAPLANDAU); obj.MATRICHNGANG = Ultils.NullValue(data.MATRICHNGANG); obj.DIACHITRENGPLX = Ultils.NullValue(data.DIACHITRENGPLX); obj.COQUANQUANLYGPLX = Ultils.NullValue(data.COQUANQUANLYGPLX); obj.DIACHITRENGPLX_CHITIET = Ultils.NullValue(data.DIACHITRENGPLX_CHITIET); obj.IN_GPLX = Ultils.NullValueInt(data.IN_GPLX); obj.SOSERI_GPLX_DACO = Ultils.NullValue(data.SOSERI_GPLX_DACO); return(obj); }
private void txtOperatorCode_EditValueChanged(object sender, EventArgs e) { Ultils.SetColorDefaultTextControl(txtOperatorCode); }
private void ConversationWorker_DoWork(object sender, DoWorkEventArgs e) { string url = Ultils.getUrl(); List <Conversation> ConversationList = new List <Conversation>(); ObservableCollection <ConversationsView> conversationsViewsList = new ObservableCollection <ConversationsView>(); try { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(url); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AppInstance.getInstance().GetUser().Token); HttpResponseMessage response = client.GetAsync("/api/Users/Owner/Conversations", HttpCompletionOption.ResponseContentRead).Result; ConversationList = response.Content.ReadAsAsync <List <Conversation> >().Result; if (response.IsSuccessStatusCode) { AppInstance.getInstance().SetConversation(ConversationList); } } } catch (Exception ee) { } foreach (Conversation conver in ConversationList) { string lastMess = ""; string time = ""; long lastMessUserId = 0; using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(url); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AppInstance.getInstance().GetUser().Token); HttpResponseMessage response = client.GetAsync("/api/Conversations/Messages/Last?id=" + conver.Id, HttpCompletionOption.ResponseContentRead).Result; Message mess = response.Content.ReadAsAsync <Message>().Result; if (response.IsSuccessStatusCode) { lastMess = mess.Content; } if (mess.Type == 2) { lastMess = "Send a picture"; } time = mess.ArrivalTime.ToString("hh:mm dd/MM"); if (time.Equals("12:00 01/01")) { time = ""; } lastMessUserId = mess.SenderId; } conversationsViewsList.Add(new ConversationsView() { Pk_seq = conver.Id, Text = conver.Name, Mess = lastMess, MessUserId = lastMessUserId, Date = time, Avatar = ImageSupportInstance.getInstance().GetUserImageFromId(lastMessUserId) });; } e.Result = conversationsViewsList; }
private void txtWorkingOrder_EditValueChanged(object sender, EventArgs e) { Ultils.SetColorDefaultTextControl(txtWorkingOrder); }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtUnitID.Text)) { Ultils.TextControlNotNull(txtUnitID, "Mã Đơn Vị"); } else if (string.IsNullOrEmpty(txtUnitName.Text)) { Ultils.TextControlNotNull(txtUnitName, "Tên Đơn Vị"); } else { if (string.IsNullOrEmpty(_unitId)) { _unit = new Unit() { UnitID = txtUnitID.Text.Trim(), UnitName = txtUnitName.Text, Active = checkActive.Checked, CreatedDate = DateTime.Now, CreatedBy = Program.CurrentUser.Username, }; try { if (_unitService.CheckUnitIdExit(_unit.UnitID)) { _unitService.Add(_unit); _logService.InsertLog(Program.CurrentUser.Username, "Thêm", this.Text); MessageBoxHelper.ShowMessageBoxSuccess("Thêm thành công!"); ResetControls(); } else { MessageBoxHelper.ShowMessageBoxError(string.Format("Mã Đơn vị <{0}> này đã được tạo rồi!", _unit.UnitID)); } } catch (Exception ex) { MessageBoxHelper.ShowMessageBoxError(ex.Message); } } else { _unit = _unitService.GetUnitById(_unitId); if (_unitId != null) { _unit.UnitName = txtUnitName.Text; _unit.Description = txtDescription.Text; _unit.Active = checkActive.Checked; _unit.ModifyDate = DateTime.Now; _unit.ModifyBy = Program.CurrentUser.Username; try { _unitService.Update(_unit); MessageBoxHelper.ShowMessageBoxSuccess("Sửa thành công!"); ResetControls(); } catch (Exception ex) { MessageBoxHelper.ShowMessageBoxError(ex.Message); } } } } }
private void txtBoxID_EditValueChanged(object sender, EventArgs e) { Ultils.SetColorDefaultTextControl(txtBoxID); }
private void gridLookUpEditModelID_EditValueChanged(object sender, EventArgs e) { Ultils.SetColorDefaultGridLookUpEdit(gridLookUpEditModelID); }