bool _save_log_()
        {
            bool r = false;

            r = new io_msaccdb_tbDataLog().WriteData(); //save log to tb_datalog
            if (MyGlobal.MyTesting.TotalResult == "PASS")
            {
                r = new io_msaccdb_tbDataProductionLot().WriteData(); //write serial to tb_DataProductionLot
                r = new io_msaccdb_tbIMEISerialPrint().WriteData();   //write product to tbIMEISerialPrint
            }
            MyGlobal.MyTesting.ProductSerial = "";                    //clear product serial number
            return(r);
        }
Beispiel #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button b = sender as Button;

            if (MyGlobal.MyTesting.LotName == null || MyGlobal.MyTesting.LotName.Length != 14)
            {
                MessageBox.Show("Thông tin LOT chưa cài đặt.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }


            switch (b.Content)
            {
            case "Start Bulk Rework": {
                MyGlobal.MySetting.ProductionStatus = "BulkRework";

                //delete all data in table: IMEI_SN_Print, tb_DataProductionLOT_Bulk
                bool r = false;
                r = new io_msaccdb_tbIMEISerialPrint().DeleteAll();
                r = new io_msaccdb_tbDataProductionLot().DeleteAll();
                break;
            }

            case "End Bulk Rework": {
                MyGlobal.MySetting.ProductionStatus = "Normal";
                //delete all data in table: IMEI_SN_Print, tb_DataProductionLOT_Bulk
                bool r = false;
                r = new io_msaccdb_tbIMEISerialPrint().DeleteAll();
                break;
            }
            }

            //gen LOT
            bool flag_index_change = MyGlobal.MyTesting.LotCount == "0" ? false : true; //true = +1 vao chi so LOT, false = ko thay doi

            MyGlobal.MyTesting.LotCount = "0";
            MyGlobal.MyTesting.LotName  = new GenerateLOT(MyGlobal.MySetting.LineIndex, MyGlobal.MySetting.ProductionPlace, MyGlobal.MySetting.ProductionYear, MyGlobal.MySetting.ProductNumber, MyGlobal.MySetting.LOTIndex, flag_index_change).Gererate();
            //delete IMEI_SN_Print talbe
            new io_msaccdb_tbIMEISerialPrint().DeleteAll();

            //save setting
            XmlHelper <MyFunction.Custom.Proj_SettingInformation> .ToXmlFile(MyGlobal.MySetting, MyGlobal.Setting_FileFullName);
        }
Beispiel #3
0
        bool _save_log_()
        {
            bool r = false;

            r = new io_msaccdb_tbDataProductionLot().UpdateReworkData(Proj_Rework.ProductionLot, Proj_Rework.ReworkSerial, Proj_Rework.NewProductSerial, Proj_Rework.Reason, Proj_Rework.Operator);
            r = new io_msaccdb_tbDataProductionLot().WriteData(Proj_Rework);

            //print label
            if (Proj_Rework.AutoPrintLabel == true)
            {
                Thread t = new Thread(new ThreadStart(() => {
                    string msg;
                    bool ret = new ReprintProductionLot(Proj_Rework.ProductionLot).Print(out msg);
                    MessageBox.Show(ret ? "Success" : "Fail\n" + msg, "Reprint LOT " + Proj_Rework.ProductionLot, MessageBoxButton.OK, r ? MessageBoxImage.Information : MessageBoxImage.Error);
                }));
                t.IsBackground = true;
                t.Start();
            }

            Proj_Rework.NewProductSerial = ""; //clear product serial number
            return(r);
        }
        public bool Print(out string message)
        {
            message = "";
            try {
                bool r = false;

                //delete all data row in tb_Template
                r = _delete_All_DataRow_In_Table_(tbtemp);
                if (!r)
                {
                    message = "Cant delete all data row in tb_Template."; return(r);
                }

                //copy all data row from IMEI_SN_Print to tb_Template
                r = _copy_All_DataRow_From_Table1_To_Table2_(tbtemp, tbprint);
                if (!r)
                {
                    message = "Cant copy all data row from IMEI_SN_Print to tb_Template."; return(r);
                }

                //get all product in lot name from tb_DataProductionLOT
                List <msaccdb_tbDataProductionLOT> productlot = new io_msaccdb_tbDataProductionLot().ReadProduct(this.lot);
                if (productlot == null)
                {
                    message = "Lot status is in progress."; return(false);
                }
                if (productlot.Count == 0)
                {
                    message = "Lot status is in progress."; return(false);
                }
                if (productlot.Count != int.Parse(productlot[0].LotQuantity))
                {
                    message = string.Format("Lot status is in progress: qty {0}, actual {1}.", productlot[0].LotQuantity, productlot.Count); return(false);
                }

                //delete all data row in IMEI_SN_Print
                r = _delete_All_DataRow_In_Table_(tbprint);
                if (!r)
                {
                    message = "Cant delete all data row in IMEI_SN_Print."; return(r);
                }

                //insert all product in lot name into IMEI_SN_Print
                foreach (var product in productlot)
                {
                    new io_msaccdb_tbIMEISerialPrint(product).WriteData();
                }

                //reprint label
                MyGlobal.MasterBox.Print_Access_Report("IMEI_SN_fPrint");
                Thread.Sleep(100);


                //delete all data row in IMEI_SN_Print
                r = _delete_All_DataRow_In_Table_(tbprint);
                if (!r)
                {
                    message = "Cant delete all data row in IMEI_SN_Print."; return(r);
                }

                //copy all data row from tb_Template to IMEI_SN_Print
                r = _copy_All_DataRow_From_Table1_To_Table2_(tbprint, tbtemp);
                if (!r)
                {
                    message = "Cant copy all data row from tb_Template to IMEI_SN_Print."; return(r);
                }

                return(true);
            } catch (Exception ex) {
                message = ex.ToString();
                return(false);
            }
        }