Beispiel #1
0
 public ReasonWindow(ref Proj_ReworkInformation proj_Rework)
 {
     InitializeComponent();
     rework = proj_Rework;
     //
     this.txt_operator.Focus();
 }
Beispiel #2
0
 public ReworkWindow(Proj_ReworkInformation _ReworkInformation, Init_Product _Product)
 {
     InitializeComponent();
     //
     this.Proj_Rework  = _ReworkInformation;
     this.init_Product = _Product;
     //
     this.DataContext = this.Proj_Rework;
     //
     this.txtnewproduct.Focus();
 }
Beispiel #3
0
        /// <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);
            }
        }
 public imp_Rework(Proj_ReworkInformation _ReworkInformation, Init_Product _Product)
 {
     this.reworkInformation = _ReworkInformation;
     this.product           = _Product;
 }
        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;
        }