bool saveData() { if (!ValidateForm()) { return(false); } _StockCD.CDCode = txtCDCode.Text.Trim(); _StockCD.CDName = txtCDName.Text.Trim(); _StockCD.StockName = cboStockName.Text.Trim(); _StockCD.StockID = TextUtils.ToInt(cboStockName.SelectedValue); _StockCD.TaktTime = txtTaktTime.Value; if (_StockCD.CDCode.Trim().ToUpper().Contains("MOTOR")) { _StockCD.NameLocation = txtLocation.Text.Trim(); } else { _StockCD.NameLocation = txtLocation.Text.Trim() + "%"; } if (_StockCD.ID > 0) { AssemblyStockBO.Instance.Update(_StockCD); TextUtils.ExcuteSQL($"Update Location set CDName='{txtCDName.Text.Trim()}' where CDID={_StockCD.ID}"); } else { _StockCD.ID = (int)AssemblyStockBO.Instance.Insert(_StockCD); } return(true); }
private void btnDelete_Click(object sender, EventArgs e) { try { int id = TextUtils.ToInt(grvDetail.GetFocusedRowCellValue(colWorkingID)); if (id == 0) { return; } if (MessageBox.Show("Bạn có chắc muốn xóa mục cần kiểm tra [" + grvDetail.GetFocusedRowCellValue(colWorkingName).ToString() + "] không?", TextUtils.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } WorkingBO.Instance.Delete(id); grvDetail.DeleteSelectedRows(); //Xóa các thằng con thuộc thằng cha này đi TextUtils.ExcuteSQL(string.Format("EXEC spUpdateMultiProductWorking {0}, 2", id)); } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnCopy_Click(object sender, EventArgs e) { int count = Check.CheckedItems.Count;//.CheckedItemsCount; for (int i = 0; i < count; i++) { int productGroupID = TextUtils.ToInt(Check.CheckedItems[i]); TextUtils.ExcuteSQL(string.Format($"EXEC spCopyWorkingStepToOtherProductGroup @WorkingStepDescription=N'{StepName}' ,@WorkingStepSortOrder={SortOrder} ,@WorkingStepCode=N'{StepCode}' ,@WorkingStepID={WorkingStepID} ,@ProductGroupID={productGroupID} ")); } MessageBox.Show("Copy OK!"); this.Close(); }
private void PrintReportToolStripButton_Click(object sender, EventArgs e) { /* Chọn máy in trong danh sách */ if (mode == 1) { PrintDialog PrintDialog1 = new PrintDialog(); DialogResult result = PrintDialog1.ShowDialog(); if (result == DialogResult.OK) { rpt.PrintOptions.PrinterName = PrintDialog1.PrinterSettings.PrinterName; rpt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter; rpt.PrintToPrinter(1, true, 1, 99); //; crystalReportViewer1.ViewCount); string sql = "Insert Into PrintVAT(DateTime, FolioNo, RoomNo, GuestName, CompanyName, TaxCode, Address,AmountBeforeTax, VAT5, VAT10, AmountAfterTax, FullName,UserName, ComputerName, PrinterName,Status) Values " + " ('" + TextUtils.GetSystemDate().ToString("MM/dd/yyy hh:mm:ss tt") + "', " + Convert.ToInt32(FormulaFieldsValue[5]) + " ,'" + FormulaFieldsValue[0] + "',N'" + FormulaFieldsValue[6] + "', " + " N'" + (FormulaFieldsValue[7]) + "', N'" + (FormulaFieldsValue[8]) + "',N'" + (FormulaFieldsValue[9]) + "', " + " '" + ((FormulaFieldsValue[18])) + "', '" + ((FormulaFieldsValue[20])) + "', '" + ((FormulaFieldsValue[21])) + "','" + ((FormulaFieldsValue[22])) + "', " + " N'" + Global.AppFullName + "',N'" + Global.AppUserName + "','" + TextUtils.GetHostName() + "','" + PrintDialog1.PrinterSettings.PrinterName + "',1)"; TextUtils.ExcuteSQL(sql); TextUtils.ExcuteSQL("Update Folio Set IsPrintVAT =1 Where ID = " + Convert.ToInt32(FormulaFieldsValue[5])); //ActionPosting.InsertHistory(TextUtils.GetSystemDate(), TextUtils.GetBusinessDate(), TextUtils.ToInt(FormulaFieldsValue[5]), TextUtils.ToInt(FormulaFieldsValue[5]), FormulaFieldsValue[5], ActionPosting.HistoryType.Print, // ActionPosting.GetActionText(ActionPosting.HistoryType.Print, "", "Print VAT Invoice "), // Global.UserName, "", "Print VAT Invoice", TextUtils.ToDecimal((FormulaFieldsValue[22])), TextUtils.GetHostName() + PrintDialog1.PrinterSettings.PrinterName, "", "", ""); } } else { #region Khong hoi may in ////rpt.PrintOptions.PrinterName = GetDefaultPrinter(); ////rpt.PrintToPrinter(1, true, 1, 99); //; crystalReportViewer1.ViewCount); #endregion PrintDialog PrintDialog1 = new PrintDialog(); DialogResult result = PrintDialog1.ShowDialog(); if (result == DialogResult.OK) { rpt.PrintOptions.PrinterName = PrintDialog1.PrinterSettings.PrinterName; rpt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4; rpt.PrintToPrinter(1, true, 1, 99); //ActionPosting.InsertHistory(Convert.ToDateTime(TextUtils.GetSystemDate()), Convert.ToDateTime(TextUtils.GetBusinessDate()), TextUtils.ToInt(FormulaFieldsValue[6]), TextUtils.ToInt(FormulaFieldsValue[6]), "", ActionPosting.HistoryType.Print, // ActionPosting.GetActionText(ActionPosting.HistoryType.Print, "", "Print Folio "), // Global.UserName, "", "PrintFolio", TextUtils.ToDecimal((FormulaFieldsValue[19])), TextUtils.GetHostName(), "", "", ""); } } }
private void btnSaveFontSize_Click(object sender, EventArgs e) { // check đã nhập chưa bool checkPass = checkInput(txtTakt.Text, txtTcpIp.Text, txtPort.Text); if (!checkPass) { return; } ArrayList arr = AndonConfigBO.Instance.FindAll(); if (arr.Count > 0) { AndonConfigModel andonConfig = (AndonConfigModel)arr[0]; andonConfig.FontSize1 = numFontValueCD.Value; andonConfig.FontSize2 = numFontTitleCD.Value; andonConfig.FontSize3 = numFontValuePlan.Value; andonConfig.FontSize4 = numFontLabelPlan.Value; andonConfig.FontSize5 = numFontTitleAndon.Value; andonConfig.FontSize6 = numLabelTakt.Value; andonConfig.FontSize7 = numValueTakt.Value; andonConfig.TcpIp = TextUtils.ToString(txtTcpIp.Text); andonConfig.SocketPort = TextUtils.ToInt(txtPort.Text); andonConfig.Takt = TextUtils.ToInt(txtTakt.Text); AndonConfigBO.Instance.Update(andonConfig); MessageBox.Show("Config font size successfully! "); TextUtils.ExcuteSQL("exec spUpdateTakt @Takt = " + andonConfig.Takt); } else { AndonConfigModel andonConfig = new AndonConfigModel(); andonConfig.FontSize1 = numFontValueCD.Value; andonConfig.FontSize2 = numFontTitleCD.Value; andonConfig.FontSize3 = numFontValuePlan.Value; andonConfig.FontSize4 = numFontLabelPlan.Value; andonConfig.FontSize5 = numFontTitleAndon.Value; andonConfig.FontSize6 = numLabelTakt.Value; andonConfig.FontSize7 = numValueTakt.Value; andonConfig.TcpIp = TextUtils.ToString(txtTcpIp.Text); andonConfig.SocketPort = TextUtils.ToInt(txtPort.Text); andonConfig.Takt = TextUtils.ToInt(txtTakt.Text); AndonConfigBO.Instance.Insert(andonConfig); MessageBox.Show("Config font size successfully! "); TextUtils.ExcuteSQL("exec spUpdateTakt @Takt = " + andonConfig.Takt); } }
bool saveData() { if (!ValidateForm()) { return(false); } _Stock.Name = txtStockName.Text.Trim(); _Stock.Code = txtStockCode.Text.Trim(); if (_Stock.ID > 0) { AssemblyStockBO.Instance.Update(_Stock); TextUtils.ExcuteSQL($"Update StockCD set StockName=N'{txtStockName.Text.Trim()}' where StockID={_Stock.ID}"); } else { _Stock.ID = (int)AssemblyStockBO.Instance.Insert(_Stock); } return(true); }
//pb053153 private void btnSave_Click(object sender, EventArgs e) { grvDetail.FocusedRowHandle = -1; for (int i = 0; i < grvDetail.RowCount; i++) { int id = TextUtils.ToInt(grvDetail.GetRowCellValue(i, colWorkingID)); if (id == 0) { continue; } string value = TextUtils.ToString(grvDetail.GetRowCellValue(i, colValue)); decimal min = TextUtils.ToDecimal(grvDetail.GetRowCellValue(i, colMin)); decimal max = TextUtils.ToDecimal(grvDetail.GetRowCellValue(i, colMax)); string updateSql = string.Format(@"UPDATE dbo.ProductWorking SET PeriodValue = '{0}' , MinValue = {1}, MaxValue = {2} WHERE ID = {3}", value, min, max, id); TextUtils.ExcuteSQL(updateSql); } //MessageBox.Show("Cất dữ liệu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); //loadWorking(); }
private void btnSave_Click(object sender, EventArgs e) { grvDetail.FocusedRowHandle = -1; for (int i = 0; i < grvDetail.RowCount; i++) { int id = TextUtils.ToInt(grvDetail.GetRowCellValue(i, colID2)); if (id == 0) { continue; } string value = TextUtils.ToString(grvDetail.GetRowCellValue(i, colValue)); decimal min = TextUtils.ToDecimal(grvDetail.GetRowCellValue(i, colMin)); decimal max = TextUtils.ToDecimal(grvDetail.GetRowCellValue(i, colMax)); decimal defaultValue = TextUtils.ToDecimal(grvDetail.GetRowCellValue(i, colDefaultValue)); string tansuat = TextUtils.ToString(grvDetail.GetRowCellValue(i, colTanSuat)); string updateSql = string.Format("UPDATE dbo.GearWorking SET PeriodValue = '{0}' , MinValue = {1}, MaxValue = {2}, DefaultValue = {3}, TanSuat = '{4}'" + " WHERE ID = {5}", value, min, max, defaultValue, tansuat, id); //giá trị decimal sau khi Format dấu . thành dấu , nên lệnh sql bị sai TextUtils.ExcuteSQL(updateSql); } MessageBox.Show("OK"); }
private void btnChoose_Click(object sender, EventArgs e) { //Nếu đang sử dụng database thì thôi if (TextUtils.ToBoolean(grvData.GetFocusedRowCellValue(colIsUse))) { MessageBox.Show("Dữ liệu này đang được sử dụng.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } //progressBar.Visible = true; //Thread.Sleep(5000); //progressBar.Visible = false; //return; using (WaitDialogForm fWait = new WaitDialogForm("", "")) { try { string fileAltax = TextUtils.ToString(grvData.GetFocusedRowCellValue(colAltax)); string fileHyp = TextUtils.ToString(grvData.GetFocusedRowCellValue(colHyp)); int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); //Restore database file đã chọn vào database backup string sqlRestore = $"exec spRestoreDatabase @FileNameAltax = '{fileAltax.Trim()}',@FileNameHyp='{fileHyp.Trim()}'"; //Update lại trạng thái database đã được sử dụng string sqlUpdateIsUse = $"exec spUpdateBackupVersion {id}"; TextUtils.ExcuteSQL($"{sqlRestore};{sqlUpdateIsUse}"); loadData(); this.DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
void updateSungLuc() { List <string> lstError = new List <string>(); for (int i = 0; i < grvData.RowCount; i++) { string productCode = Lib.ToString(grvData.GetRowCellValue(i, "F1")); try { //string productCode = Lib.ToString(grvData.GetRowCellValue(i, "F1")); string GunNumber = Lib.ToString(grvData.GetRowCellValue(i, "F23")); string JobNumber = Lib.ToString(grvData.GetRowCellValue(i, "F24")); string QtyOcBanGa = Lib.ToString(grvData.GetRowCellValue(i, "F27")); string QtyOcBanThat = Lib.ToString(grvData.GetRowCellValue(i, "F28")); string[] numberGuns = Regex.Split(GunNumber, @"[^0-9\.]+"); string[] numberJobNumbers = Regex.Split(JobNumber, @"[^0-9\.]+"); int gun = TextUtils.ToInt(numberGuns[1]); int job = TextUtils.ToInt(numberJobNumbers[1]); string sql = string.Format(@"UPDATE dbo.Product SET GunNumber = {0},JobNumber = {1}, QtyOcBanGa= {2}, QtyOcBanThat = {3} WHERE ProductCode ='{4}'" , gun , job , TextUtils.ToInt(QtyOcBanGa) , TextUtils.ToInt(QtyOcBanThat) , productCode); TextUtils.ExcuteSQL(sql); } catch { //MessageBox.Show(productCode); } } MessageBox.Show("OK"); }
private void btnSave_Click(object sender, EventArgs e) { TextUtils.ExcuteSQL(string.Format(@"{0}", txtName.Text.Trim())); txtName.Text = ""; }
/// <summary> /// Cất dữ liệu /// </summary> /// <returns></returns> bool saveData() { if (!ValidateForm()) { return(false); } Product.ProductGroupID = TextUtils.ToInt(cboGroup.EditValue); Product.ProductTypeCode = txtProductTypeCode.Text.Trim(); Product.ProductCode = txtCode.Text.Trim(); Product.ProductName = txtDes.Text.Trim(); Product.RatioCode = txtRatio.Text.Trim(); Product.PinNumber = txtPinNumber.Text.Trim(); Product.PinNumberIN = txtPinNumberIN.Text.Trim(); Product.CoilCode = txtCoilCode.Text.Trim(); Product.MotorCode = txtMotorCode.Text.Trim(); Product.LoaiMo = txtLoaiMo.Text.Trim(); Product.LuongMo = txtLuongMo.Value; Product.MURATA = txtMurata.Text.Trim(); Product.UnitMotor = txtUnitMotor.Text.Trim(); Product.MauSon = txtMauSon.Text.Trim(); Product.MEDEDAY = TextUtils.ToDate2(dtpMEDEDAY.EditValue); Product.ProductDate = TextUtils.ToDate2(dtpDate.EditValue); Product.HuongHopCau = txtHuongHopCau.Text.Trim(); Product.DienAp = txtDienAp.Value; Product.TanSo = txtTanSo.Value; Product.DongDienMin = txtDongDienMin.Value; Product.DongDienMax = txtDongDienMax.Value; Product.NhapLucMax = txtNhapLucMax.Value; Product.NhapLucMin = txtNhapLucMin.Value; Product.VongQuayMax = txtVongQuayMax.Value; Product.VongQuayMin = txtVongQuayMin.Value; Product.TiengOnMax = txtTiengOnMax.Value; Product.TiengOnMin = txtTiengOnMin.Value; Product.DoRungFFTMax = txtDoRungMax.Value; Product.DoRungFFTMin = txtDoRungMin.Value; Product.GunNumber = TextUtils.ToInt(txtGunNumber.Value); Product.JobNumber = TextUtils.ToInt(txtJobNumber.Value); Product.QtyOcBanGa = TextUtils.ToInt(txtQtyOcBanGa.Value); Product.QtyOcBanThat = TextUtils.ToInt(txtQtyOcBanThat.Value); Product.BuLongNumber = TextUtils.ToInt(txtBuLongNumber.Value); Product.ShootNumber = TextUtils.ToInt(txtShootNumber.Value); Product.SetForce = TextUtils.ToInt(txtSetForce.Value); Product.DifferenceMax = txtDifferenceMax.Value; Product.DifferenceMin = txtDifferenceMin.Value; Product.SizeSSSMax = txtSizeSSSMax.Value; Product.SizeSSSMin = txtSizeSSSMin.Value; Product.SpaceCenterMax = txtSpaceCenterMax.Value; Product.SpaceCenterMin = txtSpaceCenterMin.Value; Product.SpaceCycloidDiskMin = txtSpaceCycloidDiskMin.Value; Product.SpaceCycloidDiskMax = txtSpaceCycloidDiskMax.Value; Product.LucCheckGearMax = txtLucCheckGearMax.Value; Product.LucCheckGearMin = txtLucCheckGearMin.Value; Product.LucCheckGearMotorMax = txtLucCheckGearMotorMax.Value; Product.LucCheckGearMotorMin = txtLucCheckGearMotorMin.Value; Product.LucCheck3Max = txtLucCheck3Max.Value; //Lực check cụm trục tốc độ thấp 511-512 Product.LucCheck3Min = txtLucCheck3Min.Value; Product.LucCheck4Max = txtLucCheck4Max.Value; //Lực check phần xuất lực Naknishi Product.LucCheck4Min = txtLucCheck4Min.Value; Product.LucCheck5Max = txtLucCheck5Max.Value; //Lực check Ốc chặn mỡ Nakanishi, 6000 Product.LucCheck5Min = txtLucCheck5Min.Value; Product.DoDao1Max = txtDoDao1Max.Value; //ĐẢO TRƯỚC ÉP VÒNG BI Product.DoDao1Min = txtDoDao1Min.Value; Product.DoDao2Max = txtDoDao2Max.Value; //ĐẢO SAU ÉP VÒNG BI Product.DoDao2Min = txtDoDao2Min.Value; Product.DoDao3Max = txtDoDao3Max.Value; Product.DoDao3Min = txtDoDao3Min.Value; Product.DoDao4Max = txtDoDao4Max.Value; Product.DoDao4Min = txtDoDao4Min.Value; Product.LuongMo1Max = txtLuongMo1Max.Value; //Mỡ cho trục tốc độ thấp Product.LuongMo1Min = txtLuongMo1Min.Value; // Product.LuongMo2Max = txtLuongMo2Max.Value; //Lượng mỡ cho hộp Product.LuongMo2Min = txtLuongMo2Min.Value; // Product.LuongMo3Max = txtLuongMo3Max.Value; //Mỡ cho vòng bi chịu tải & Carrier SSS Product.LuongMo3Min = txtLuongMo3Min.Value; // Product.LuongMo4Max = txtLuongMo4Max.Value; //Lượng mỡ cho vòng bi không tải Product.LuongMo4Min = txtLuongMo4Min.Value; // Product.LuongMo5Max = txtLuongMo5Max.Value; //Mỡ cho Carrier Product.LuongMo5Min = txtLuongMo5Min.Value; // Product.LuongMo6Max = txtLuongMo6Max.Value; //Mỡ cho hộp (Gram) ở công đoạn 3, số thứ tự 50 của 511,512 Product.LuongMo6Min = txtLuongMo6Min.Value; // Product.LuongMo7Max = txtLuongMo7Max.Value; // Product.LuongMo7Min = txtLuongMo7Min.Value; // Product.Goal = txtGoal.Text.Trim(); if (Product.ID > 0) { WorkingBO.Instance.Update(Product); } else { Product.ID = (int)WorkingBO.Instance.Insert(Product); //Sinh các công đoạn và mục kiểm tra của sản phẩm theo định dạng của nhóm sản phẩm TextUtils.ExcuteSQL(string.Format("EXEC dbo.CreateProductWorking_ByGroupID {0},{1}", Product.ProductGroupID, Product.ID)); } /* * Cập nhật lại các mục check sản phẩm theo các rule quy định của các công đoạn */ //TextUtils.ExcuteSQL(string.Format("EXEC spUpdateProductWorking_ByProductID {0},{1}", Product.ID, Product.MURATA == "3" ? 0 : 1)); TextUtils.ExcuteSQL(string.Format("EXEC spUpdateProductWorking_ByProductID_New {0},{1}", Product.ID, Product.MURATA == "3" ? 0 : 1)); return(true); }
/// <summary> /// Cất dữ liệu /// </summary> /// <returns></returns> bool saveData() { if (!ValidateForm()) { return(false); } WorkingModel.ProductGroupID = TextUtils.ToInt(cboGroup.EditValue); WorkingModel.WorkingStepID = TextUtils.ToInt(cboStep.EditValue); WorkingModel.WorkingName = txtName.Text.Trim(); WorkingModel.SortOrder = (int)txtSortOrder.Value; WorkingModel.Unit = txtUnit.Text.Trim(); WorkingModel.ValueType = cboValueType.SelectedIndex; WorkingModel.ValueTypeName = cboValueType.SelectedIndex == 0 ? "Check mark" : "Giá trị\n数値"; WorkingModel.MaxValue = TextUtils.ToDecimal(txtMax.Value); WorkingModel.MinValue = TextUtils.ToDecimal(txtMin.Value); // WorkingModel.PeriodValue = WorkingModel.MinValue + "~" + WorkingModel.MaxValue; WorkingModel.IsGetAutoValueComport = chkAutoValue.Checked; WorkingModel.Comport = cboComPort.SelectedIndex + 1; WorkingModel.CheckValueType = cboCheckValueType.SelectedIndex; WorkingModel.IsGetAutoValueIP = chkIP.Checked; WorkingModel.IpAddress = txtIP.Text.Trim(); WorkingModel.Port = txtPort.Text.Trim(); if (WorkingModel.ValueType == 0)//checkmark { WorkingModel.PeriodValue = txtPeriodValue.Text.Trim(); } else { if (WorkingModel.CheckValueType == 1)//giá trị dạng số { if (WorkingModel.MinValue == WorkingModel.MaxValue) { WorkingModel.PeriodValue = WorkingModel.MaxValue.ToString("n3"); } else { WorkingModel.PeriodValue = WorkingModel.MinValue.ToString("n3") + "~" + WorkingModel.MaxValue.ToString("n3"); } } else { WorkingModel.PeriodValue = txtPeriodValue.Text.Trim(); } } if (WorkingModel.ID > 0) { WorkingBO.Instance.Update(WorkingModel); TextUtils.ExcuteSQL(string.Format("EXEC spUpdateMultiProductWorking {0}, 1", WorkingModel.ID)); } else { WorkingModel.ID = (int)WorkingBO.Instance.Insert(WorkingModel); TextUtils.ExcuteSQL(string.Format("EXEC CreateProductWorking_ByWorkingID {0}", WorkingModel.ID)); } return(true); }