Esempio n. 1
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            QRData.LotStart = DateTime.Now;
            QRData.Recipes  = textBoxRecipes.Text;


            webService = new WebServiceAPCS.ServiceiLibraryClient(); //เช็คค่าจากเว็บ SV
            WebServiceAPCS.StartLotResult startLot = webService.StartLot(QRData.LotNo, QRData.McNo, QRData.EmpNo, QRData.Recipes);

            if (startLot.IsPass == false)
            {
                MessageDialog.MessageBoxDialog.ShowMessageDialog("Start Lot", startLot.Cause, startLot.Type.ToString());
                return;
            }
            else
            {
                InsertSqlData(labelLotNo.Text, labelMcNo.Text, QRData.LotStart);
                SaveXml(QRData, AppDomain.CurrentDomain.BaseDirectory + "/xmlData.txt");
                ClassLog.SaveLog("Click Start Button", "Lot No.:" + QRData.LotNo, QRData.McNo, QRData.EmpNo + "| InputQty: " + QRData.InputQty);


                labelStatus.Text             = "Status : Lot Running";
                buttonStart.Enabled          = false;
                buttonStart.BackgroundImage  = test2.Properties.Resources.Start_gray;
                buttonLotEnd.Enabled         = true;
                buttonLotEnd.BackgroundImage = test2.Properties.Resources.End_blue;
                buttonCancelLot.Visible      = false;
                pictureBox1.Visible          = false;
                pictureBox2.Visible          = true;
            }
            // classDataQRBindingSource.ResetBindings(true);
        }
Esempio n. 2
0
        private void textBoxScanQr_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)13)                //ตรวจสอบว่าพิมพ์เสร็จหรือยัง
            {
                if (textBoxScanQr.Text.Length == 252) //ตรวจสอบความยาวของข้อความใน textbox
                {
                    // label2.Text = textBoxScanQr.Text.Substring(0, 10);
                    DataQR.McNo        = Properties.Settings.Default.McNo;
                    DataQR.LotNo       = textBoxScanQr.Text.Substring(30, 10);
                    DataQR.DeviceName  = textBoxScanQr.Text.Substring(10, 20);
                    DataQR.PackageName = textBoxScanQr.Text.Substring(0, 10);
                    DataQR.LotSetting  = DateTime.Now;//บันทึกค่าลง class
                    DataQR.Ver         = Properties.Settings.Default.Version;
                    DataQR.McType      = Properties.Settings.Default.McType;

                    FormScanEmp  scanEmp = new FormScanEmp(DataQR);
                    DialogResult result  = scanEmp.ShowDialog();

                    DataQR.LotStart  = null;
                    DataQR.LotClose  = null;
                    DataQR.TotalNg   = null;
                    DataQR.MarkerM   = 0;
                    DataQR.MarkerK   = 0;
                    DataQR.MekaNG    = 0;
                    DataQR.MissingIC = 0;
                    if (result == DialogResult.OK)
                    {
                        webService = new WebServiceAPCS.ServiceiLibraryClient(); //เช็คค่าจากเว็บ SV
                        WebServiceAPCS.SetupLotResult setupLot = webService.SetupLot(DataQR.LotNo, DataQR.McNo, DataQR.EmpNo, Properties.Settings.Default.ProcessName, Properties.Settings.Default.LayNo);

                        if (setupLot.IsPass == WebServiceAPCS.SetupLotResult.Status.NotPass)
                        {
                            MessageDialog.MessageBoxDialog.ShowMessageDialog("Input Lot", setupLot.Cause, setupLot.Type.ToString());
                            DataQR.LotNo       = null;
                            DataQR.DeviceName  = null;
                            DataQR.PackageName = null;
                            DataQR.LotSetting  = null;//บันทึกค่าลง class
                            DataQR.EmpNo       = null;
                            DataQR.InputQty    = null;
                            DialogResult       = DialogResult.No;
                        }
                        else
                        {
                            DataQR.Recipes = setupLot.Recipe;
                            SaveXml(DataQR, AppDomain.CurrentDomain.BaseDirectory + "/xmlData.txt"); //บันทึกข้อมูลลงไฟล์ไบนารี่
                            ClassLog.SaveLog("Click Setting Button", "Lot No.:" + DataQR.LotNo, DataQR.McNo, DataQR.EmpNo);
                            DialogResult = DialogResult.OK;
                        }
                    }
                    else
                    {
                        DialogResult = DialogResult.No;
                    }
                }
            }
            progressBar1.Value = textBoxScanQr.Text.Length;
        }
Esempio n. 3
0
        private void buttonCancelLot_Click(object sender, EventArgs e)
        {
            FormEmpEnd   formEmpEnd = new FormEmpEnd(QRData);
            DialogResult result     = formEmpEnd.ShowDialog();

            //WebServiceAPCS.EndLotResult endLot = webService.EndLot(QRData.LotNo, QRData.McNo, QRData.EmpNoEnd, good, ng);
            if (result == DialogResult.OK)
            {
                webService = new WebServiceAPCS.ServiceiLibraryClient();
                WebServiceAPCS.CancelLotResult cancelLot = webService.CancelLot(QRData.McNo, QRData.LotNo, QRData.EmpNoEnd);
                if (cancelLot.IsPass == false)
                {
                    MessageDialog.MessageBoxDialog.ShowMessageDialog("End Lot", cancelLot.Cause, cancelLot.Type.ToString()); //setupLot.Cause, setupLot.Type.ToString()
                    return;
                }
                else
                {
                    ClassLog.SaveLog("Click Cancel Lot Button", "Lot No.:" + QRData.LotNo, QRData.McNo, QRData.EmpNoEnd);

                    QRData.LotNo       = null;
                    QRData.DeviceName  = null;
                    QRData.PackageName = null;
                    QRData.LotSetting  = null;//บันทึกค่าลง class
                    QRData.EmpNo       = null;
                    QRData.InputQty    = null;
                    QRData.LotStart    = null;
                    QRData.LotClose    = null;
                    QRData.TotalNg     = null;
                    QRData.MarkerM     = 0;
                    QRData.MarkerK     = 0;
                    QRData.MekaNG      = 0;
                    QRData.MissingIC   = 0;

                    SaveXml(QRData, AppDomain.CurrentDomain.BaseDirectory + "/xmlData.txt"); //update binary file

                    // ShowData(QRData);
                    //classDataQRBindingSource.ResetBindings(true);

                    labelStatus.Text             = "Status : Wait Input Lot";
                    buttonLotEnd.Enabled         = false;
                    buttonLotEnd.BackgroundImage = test2.Properties.Resources.End_gray;
                    button1.Enabled             = true;
                    button1.BackgroundImage     = test2.Properties.Resources.input_blue;
                    buttonStart.Enabled         = false;
                    buttonStart.BackgroundImage = test2.Properties.Resources.Start_gray;
                }
            }
        }
Esempio n. 4
0
        private void buttonLotEnd_Click(object sender, EventArgs e)
        {
            FormDataRecord formDataRecord   = new FormDataRecord(QRData);
            DialogResult   resultDatarecode = formDataRecord.ShowDialog();

            /////////goto emp end form ///////////////
            ///
            //check by webserv
            if (resultDatarecode == DialogResult.OK)
            {
                QRData.LotClose = DateTime.Now;
                webService      = new WebServiceAPCS.ServiceiLibraryClient();

                int good = int.Parse(QRData.TotalGood);
                int ng   = int.Parse(QRData.TotalNg);

                WebServiceAPCS.EndLotResult endLot = webService.EndLot(QRData.LotNo, QRData.McNo, QRData.EmpNoEnd, good, ng);

                if (endLot.IsPass == false)
                {
                    MessageDialog.MessageBoxDialog.ShowMessageDialog("End Lot", endLot.Cause, endLot.Type.ToString()); //setupLot.Cause, setupLot.Type.ToString()
                    return;
                }
                else
                {
                    UpdateSqlData(QRData.McNo, QRData.LotNo, QRData.LotStart);
                    SaveXml(QRData, AppDomain.CurrentDomain.BaseDirectory + "/xmlData.txt"); //update binary file
                    ClassLog.SaveLog("Click Lot End Button", "Lot No.:" + QRData.LotNo, QRData.McNo, QRData.EmpNoEnd + "| Total Good " + QRData.TotalGood + "| Total NG " + QRData.TotalNg);


                    labelStatus.Text             = "Status : Wait Input Lot";
                    buttonLotEnd.Enabled         = false;
                    buttonLotEnd.BackgroundImage = test2.Properties.Resources.End_gray;
                    button1.Enabled         = true;
                    button1.BackgroundImage = test2.Properties.Resources.input_blue;
                    pictureBox2.Visible     = false;
                }
            }
            // ShowData(QRData);
            //classDataQRBindingSource.ResetBindings(true);
        }