//check serial printed or not bool _serial_was_printed() { bool r = false; msaccdb_tbDataProductionLOT tb = MyGlobal.MasterBox.Get_Specified_DataRow_From_Access_DB_Table <msaccdb_tbDataProductionLOT>("tb_DataProductionLOT", "ProductSerial", MyGlobal.MyTesting.ProductSerial); r = tb == null; if (!r) { MyGlobal.MyTesting.ErrorMessage += string.Format("Serial Number was printed in lot {0}, date printed {1}.", tb.Lot, tb.DateTimeCreated); } MyGlobal.testFunctionLogInfo.PRINTED.Result = r ? "PASS" : "FAIL"; MyGlobal.testFunctionLogInfo.Error_Message = MyGlobal.MyTesting.ErrorMessage; return(r); }
//reprint public io_msaccdb_tbIMEISerialPrint(msaccdb_tbDataProductionLOT productionLOT) { this.tbIMEISerialPrint = new msaccdb_IMEISerialPrint(); var setting = MyGlobal.MySetting; Init_Product product = MyGlobal.Products.Single(p => p.name == productionLOT.ProductName); tbIMEISerialPrint.IMEI = ""; tbIMEISerialPrint.LoSX = productionLOT.Lot; tbIMEISerialPrint.NoLine = product.code; tbIMEISerialPrint.NoLine1 = setting.LineIndex; tbIMEISerialPrint.Colour = product.color; tbIMEISerialPrint.SN = productionLOT.ProductSerial; tbIMEISerialPrint.TimeScan = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); }
public io_msaccdb_tbDataProductionLot() { var testing = MyGlobal.MyTesting; var setting = MyGlobal.MySetting; this.tbDataProductionLot = new msaccdb_tbDataProductionLOT(); tbDataProductionLot.DateTimeCreated = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); tbDataProductionLot.Line = setting.LineIndex; tbDataProductionLot.Lot = testing.LotName; tbDataProductionLot.LotProgress = testing.LotProgress; tbDataProductionLot.LotQuantity = setting.LotQuantity; tbDataProductionLot.LotStatus = ""; tbDataProductionLot.ProductName = setting.ProductName; tbDataProductionLot.ProductSerial = testing.ProductSerial; tbDataProductionLot.Rework = "-"; }
/// <summary> /// /// </summary> /// <param name="_ReworkInformation"></param> /// <returns></returns> public bool WriteData(Proj_ReworkInformation _ReworkInformation) { try { var box = MyGlobal.MasterBox; this.tbDataProductionLot = new msaccdb_tbDataProductionLOT(); tbDataProductionLot.DateTimeCreated = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); tbDataProductionLot.Line = _ReworkInformation.Line; tbDataProductionLot.Lot = _ReworkInformation.ProductionLot; tbDataProductionLot.LotProgress = _ReworkInformation.LotProgress; tbDataProductionLot.LotQuantity = _ReworkInformation.LotQuantity; tbDataProductionLot.LotStatus = ""; tbDataProductionLot.ProductName = _ReworkInformation.ProductName; tbDataProductionLot.ProductSerial = _ReworkInformation.NewProductSerial; tbDataProductionLot.Rework = "-"; return(box.Input_New_DataRow_To_Access_DB_Table <msaccdb_tbDataProductionLOT>(MyGlobal.MySetting.ProductionStatus == "Normal" ? "tb_DataProductionLOT" : "tb_DataProductionLOT_Bulk", this.tbDataProductionLot, "tb_ID")); } catch { return(false); } }
private void MenuItem_Click(object sender, RoutedEventArgs e) { MenuItem menu = sender as MenuItem; string lot_selected = ""; msaccdb_tbDataProductionLOT row_selected = null; try { row_selected = (msaccdb_tbDataProductionLOT)this.data_grid_lot.SelectedValue; lot_selected = row_selected.Lot; } catch { return; } switch (menu.Header) { case "Reprint label": { string msg = ""; if (lot_selected != "") { Thread t = new Thread(new ThreadStart(() => { bool r = new ReprintProductionLot(lot_selected).Print(out msg); MessageBox.Show(r ? "Success" : "Fail\n" + msg, "Reprint LOT " + lot_selected, MessageBoxButton.OK, r ? MessageBoxImage.Information : MessageBoxImage.Error); })); t.IsBackground = true; t.Start(); } else { MessageBox.Show("Please select a production lot.", "Reprint", MessageBoxButton.OK, MessageBoxImage.Error); } break; } case "Rework": { Init_Product product = MyGlobal.Products.Single(x => x.name.Equals(row_selected.ProductName)); this.Proj_Rework = new Proj_ReworkInformation() { ProductionLot = row_selected.Lot, LotProgress = row_selected.LotProgress, ProductName = row_selected.ProductName, ReworkSerial = row_selected.ProductSerial, ProductInfo = product.ToString(), Line = row_selected.Line, LotQuantity = row_selected.LotQuantity, WeightLimit = string.Format("{0} ~ {1}", double.Parse(product.weight) - double.Parse(product.bias), double.Parse(product.weight) + double.Parse(product.bias)) }; MyGlobal.myWindow.WindowOpacity = 0.3; ReasonWindow reason = new ReasonWindow(ref Proj_Rework); reason.ShowDialog(); if (Proj_Rework.Operator.Trim() == "" || Proj_Rework.Reason.Trim() == "") { MessageBox.Show("Tên người thao tác hoặc lý do rework không hợp lệ.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); break; } ReworkWindow rework = new ReworkWindow(Proj_Rework, product); rework.ShowDialog(); break; } case "Refresh": { break; } } MyGlobal.myWindow.WindowOpacity = 1; }