Beispiel #1
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 #2
0
        //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");
        }
 //small rework
 public ValidateProductSerialNumber(string sn_rework, Init_Product productInfo)
 {
     validate_product_serialnumber = sn_rework;
     ValidateItems.Clear();
     ValidateItems.Add(new validate_item()
     {
         ActionName = "Invalid serial number length", ActualValue = validate_product_serialnumber.Length.ToString(), StandardValue = "15"
     });
     ValidateItems.Add(new validate_item()
     {
         ActionName = "Product number is not correct", ActualValue = _get_value_from_serial(0, 3), StandardValue = productInfo.number
     });
     ValidateItems.Add(new validate_item()
     {
         ActionName = "Rework: The place of production is not correct", ActualValue = _get_value_from_serial(3, 1), StandardValue = ""
     });
     ValidateItems.Add(new validate_item()
     {
         ActionName = "Rework: Product version is not correct", ActualValue = _get_value_from_serial(7, 1), StandardValue = ""
     });
     ValidateItems.Add(new validate_item()
     {
         ActionName = "Color code is not correct", ActualValue = _get_value_from_serial(8, 1), StandardValue = productInfo.color
     });
     ValidateItems.Add(new validate_item()
     {
         ActionName = "Rework: Year of manufacture is not correct", ActualValue = _get_value_from_serial(4, 1), StandardValue = ""
     });
     ValidateItems.Add(new validate_item()
     {
         ActionName = "The production week is not correct", ActualValue = _get_value_from_serial(5, 2), StandardValue = "01~52"
     });
     ValidateItems.Add(new validate_item()
     {
         ActionName = "The last six characters of the serial number are not hexadecimal", ActualValue = _get_value_from_serial(9, 6), StandardValue = "^[0-9,A-F]{6}$"
     });
 }
 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;
        }