예제 #1
0
        private void ToolbarAdd_Clicked(object sender, EventArgs e)
        {
            //Validasi
            if (string.IsNullOrEmpty(textbox_BarcodeID.Text) || string.IsNullOrEmpty(textbox_ItemID.Text) || string.IsNullOrEmpty(textbox_ItemName.Text))
            {
                DisplayAlert("Warning", "Barcode/Item Id/Item Name Empty", "OK");
                return;
            }

            string strJudge    = null;
            string strCriteria = null;

            if (!SwitchNG.IsToggled && Combobox_NG_SFusion.SelectedIndex < 0)
            {
                DisplayAlert("Warning", "Criteria NG Empty", "OK");
                return;
            }

            if (SwitchNG.IsToggled)
            {
                strJudge    = "OK";
                strCriteria = "";
            }
            else
            {
                strJudge = "NG";
                List <string> listselectedNG = Combobox_NG_SFusion.SelectedValue as List <string>;
                foreach (var str in listselectedNG)
                {
                    strCriteria += str + ",";
                }
            }

            SamplingQC samplingQc = new SamplingQC();

            samplingQc.BARCODE      = textbox_BarcodeID.Text;
            samplingQc.ITEM_ID      = textbox_ItemID.Text;
            samplingQc.ITEM_NAME    = textbox_ItemName.Text;
            samplingQc.NPK          = "";
            samplingQc.EmployeeName = "";
            samplingQc.ScanDate     = DateTime.Now;
            samplingQc.Detail       = EntryDetail.Text;
            samplingQc.Judgement    = strJudge;
            samplingQc.Operator1    = textbox_Operator1NPK.Text;
            samplingQc.Operator2    = textbox_Operator2NPK.Text;
            samplingQc.Operator3    = textbox_Operator3NPK.Text;
            samplingQc.Operator4    = textbox_Operator4NPK.Text;
            samplingQc.Criteria     = strCriteria;


            listDetailSamplingQC.Add(samplingQc);

            Combobox_NG_SFusion.Text = "";
            //GridControlItemSampling.ItemsSource = listDetailSamplingQC;
            //GridControlItemSampling.RefreshData();
        }
예제 #2
0
#pragma warning disable CS1998 // This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
        private async Task HandleReceivedApplicationMessage(MqttApplicationMessageReceivedEventArgs eventArgs)
#pragma warning restore CS1998 // This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
        {
            var    item    = $"Timestamp: {DateTime.Now:O} | Topic: {eventArgs.ApplicationMessage.Topic} | Payload: {eventArgs.ApplicationMessage.ConvertPayloadToString()} | QoS: {eventArgs.ApplicationMessage.QualityOfServiceLevel}";
            string topic   = eventArgs.ApplicationMessage.Topic;
            string RecvMsg = eventArgs.ApplicationMessage.ConvertPayloadToString();



            if (topic == "RESPON_BARCODE_TRIAL_INJECTION_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_BARCODE_TRIAL_INJECTION, RecvMsg);
            }

            if (topic == "RESPON_SCAN_STO" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_SCAN_STO, RecvMsg);
            }

            if (topic == "STO_LOC_GUDANG" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_LOCATION_GUDANG, RecvMsg);
            }

            if (topic == "RESPON_LOCATION_GUDANG_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_LOCATION_GUDANG, RecvMsg);
            }

            if (topic == "RESPON_BARCODE_RFID_PAIRING_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_BARCODE_RFID_PAIRING, RecvMsg);
            }

            if (topic == "RESPON_SAVE_RFID_PAIRING_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_SAVE_RFID_PAIRING, RecvMsg);
            }

            if (topic == "RESPON_RFID_DELIVERY_IN_GUDANG_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_RFID_DELIVERY_IN_GUDANG, RecvMsg);
            }

            if (topic == "RESPON_MOBIL_DELIVERY_EPSON_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_MOBIL_DELIVERY_EPSON, RecvMsg);
            }

            if (topic == "RESPON_RFID_DELIVERY_EPSON_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_RFID_DELIVERY_EPSON, RecvMsg);
            }

            if (topic == "RESPON_BARCODE_LOCATION_REWORK_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_BARCODE_LOCATION_REWORK, RecvMsg);
            }

            if (topic == "RESPON_LOCATION_REWORK_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_LOCATION_REWORK, RecvMsg);
            }

            if (topic == "RESPON_BARCODE_REWORK_ABCD" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPON_BARCODE_REWORK_IN, RecvMsg);
            }

            if (topic == "RESPON_BARCODE_DEMO_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.RESPOND_BARCODE_DEMO, RecvMsg);
            }

            if (topic == "SAVE_RESPOND_SPP_AKTIVITAS_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.SAVE_RESPOND_SPP_AKTIVITAS, RecvMsg);
            }

            if (topic == "SEND_LIST_SPP_AKTIVITAS_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.SEND_LIST_SPP_AKTIVITAS, RecvMsg);
            }

            if (topic == "SEND_SCHEDULING_1" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.Scheduling, RecvMsg);
            }

            if (topic == "SEND_SURKOM_LIST" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.Surkoms, RecvMsg);
            }

            if (topic == "SAVE_SCHEDULING_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.ResponseSave, RecvMsg);
            }

            if (topic == "SENDITEMALL_" + GlobalVar.MacAddress)
            {
                string[] strsplit = RecvMsg.Split(',');

                List <string> strarray = new List <string>();

                foreach (string newstr in strsplit)
                {
                    strarray.Add(newstr); //Result: strarray[0] = ItemID/ItemName/Model
                }
                MessagingCenter.Send <MqttHelper, List <string> >(this, MessagingCenterKeys.SENDITEMALL_, strarray);
            }

            if (topic == "RESPON_MONITORING_STOCK_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.MonitoringStock, RecvMsg);
            }

            if (topic == "RIWAYAT_BOX" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.InfoDetail, RecvMsg);
            }

            if (topic == "DATA_MACHINE_ABSENSI_OP" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.DATA_MACHINE_ABSENSI_OP, RecvMsg);
            }

            if (topic == "DATA_ABSENSI_OP" + GlobalVar.MacAddress)
            {
                if (RecvMsg == "WRONGDATA")
                {
                    MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.Data_Absensi_OP, RecvMsg);
                }
                else
                {
                    string[] strsplit = RecvMsg.Split(',');

                    List <string> strarray = new List <string>();

                    foreach (string newstr in strsplit)
                    {
                        strarray.Add(newstr); //Result: strarray[0] = CODE OPERATOR/MACHINE , strarray[1] = OP/Machine ID , strarray[2] = OP/Machine NAME
                    }

                    if (strarray[0] == "OP")
                    {
                        GlobalVar.OperatorNPK  = strarray[1];
                        GlobalVar.OperatorName = strarray[2];
                        MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.Data_Absensi_OP, "OP");
                    }
                    if (strarray[0] == "MC")
                    {
                        GlobalVar.MachineID   = strarray[1];
                        GlobalVar.MachineName = strarray[2];
                        MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.Data_Absensi_OP, "MC");
                    }
                }
            }

            if (topic == "SAVE_RESPOND_ABSENSI_OP" + GlobalVar.MacAddress)
            {
                if (RecvMsg == "SUCCESS")
                {
                    MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.Save_Respon, "SUCCESS");
                }
                if (RecvMsg == "FAILED")
                {
                    MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.Save_Respon, "FAILED");
                }
            }

            if (topic == "ReportAbsensi_ServerToClient_" + GlobalVar.MacAddress)
            {
                string[] strsplit = RecvMsg.Split(',');
                //_listreportAbsensi = new List<ReportAbsensi>();
                ReportAbsensi reportAbsensis = new ReportAbsensi();

                Device.BeginInvokeOnMainThread(async() =>
                {
                    int urutan = 0;
                    int i      = 0;
                    foreach (string newstr in strsplit)
                    {
                        if (i == 0)
                        {
                            reportAbsensis = new ReportAbsensi();
                            //reportAbsensis.StrBase64Photo = newstr;
                            //reportAbsensis.Photo = ImageSource.FromStream(() => new MemoryStream(Convert.FromBase64String(newstr)));

                            i++;
                        }
                        else if (i == 1)
                        {
                            reportAbsensis.EmployeeID = newstr;
                            //GlobalVar._listreportAbsensi[urutan].EmployeeID = newstr;
                            i++;
                        }
                        else if (i == 2)
                        {
                            reportAbsensis.EmployeeName = newstr;
                            //GlobalVar._listreportAbsensi[urutan].EmployeeName = newstr;
                            i++;
                        }
                        else if (i == 3)
                        {
                            reportAbsensis.Machine = newstr;
                            //GlobalVar._listreportAbsensi[urutan].Machine = newstr;
                            i++;
                        }
                        else if (i == 4)
                        {
                            reportAbsensis.WorkDate = newstr;
                            GlobalVar._listreportAbsensi.Add(reportAbsensis);
                            MessagingCenter.Send <MqttHelper, List <ReportAbsensi> >(this, MessagingCenterKeys.ReportAbsensi_ServerToClient_, GlobalVar._listreportAbsensi);
                            //GlobalVar._listreportAbsensi[urutan].WorkDate = newstr;
                            i = 0;
                            //urutan++;
                        }
                    }
                });
            }

            if (topic == "ReportAbsensi_ServerToClientImage_" + GlobalVar.MacAddress)
            {
                List <ImageSource> sc = new List <ImageSource>();
                Device.BeginInvokeOnMainThread(async() =>
                {
                    var photo = ImageSource.FromStream(() => new MemoryStream(eventArgs.ApplicationMessage.Payload));
                    sc.Add(photo);
                });
                MessagingCenter.Send <MqttHelper, List <ImageSource> >(this, MessagingCenterKeys.ReportAbsensi_ServerToClientImage_, sc);
            }

            if (topic == "ReportImageAbsensiOperator_ServerToClient_" + GlobalVar.MacAddress)
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    //ReportAbsensi reportAbsensis = new ReportAbsensi();
                    //reportAbsensis.EmployeeID = "AAAAA";
                    //reportAbsensis.EmployeeName = "BBBBBBBB";
                    //reportAbsensis.Machine = "CCCCCC";
                    //reportAbsensis.WorkDate = "WORKDATE";


                    //reportAbsensis.StrBase64Photo = RecvMsg;
                    //var stream1 = new MemoryStream(Convert.FromBase64String(reportAbsensis.StrBase64Photo));
                    //reportAbsensis.Photo = ImageSource.FromStream(() => stream1);


                    //reportAbsensis.StrBase64Photo = "";
                    //reportAbsensis.Photo = ImageSource.FromStream(() => new MemoryStream(eventArgs.ApplicationMessage.Payload));


                    if (GlobalVar.urutanPhotoAbsensi <= GlobalVar._listreportAbsensi.Count)
                    {
                        GlobalVar._listreportAbsensi[GlobalVar.urutanPhotoAbsensi].Photo = ImageSource.FromStream(() => new MemoryStream(eventArgs.ApplicationMessage.Payload));

                        GlobalVar.urutanPhotoAbsensi++;
                        MessagingCenter.Send <MqttHelper, List <ReportAbsensi> >(this, MessagingCenterKeys.ReportAbsensi_ServerToClient_, GlobalVar._listreportAbsensi);
                    }



                    //GlobalVar._listreportAbsensi.Add(reportAbsensis);
                    //MessagingCenter.Send<MqttHelper, List<ReportAbsensi>>(this, MessagingCenterKeys.ReportAbsensi_ServerToClient_, _listreportAbsensi);
                });


                //var stream1 = new MemoryStream(Convert.FromBase64String(RecvMsg));

                //reportAbsensis.Photo.Source = ImageSource.FromStream(() => stream1);



                //reportAbsensis.Photo = ImageSource.FromResource("Attendance");
            }

            if (topic == "ReportAbsensiFAIL_ServerToClient_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.ReportAbsensiFAIL_ServerToClient_, RecvMsg);
            }


            if (topic == "SamplingAdd_ServerToClientA" + GlobalVar.MacAddress)
            {
                string[] strsplit = RecvMsg.Split(',');

                List <string> strarray = new List <string>();

                foreach (string newstr in strsplit)
                {
                    strarray.Add(newstr); //Result: strarray[0] = BARCODE , strarray[1] = ITEM_ID , strarray[2] = ITEM_NAME , strarray[3] = QTY
                }
                ///////FORMAT/////DATA MQTT History Picking    /////"PART_NAME,BARCODE_WO,REMAINING_STOCK,QTY_PICK_UP,DATE_TAKEN"/////
                SamplingQC samplingQc = new SamplingQC();
                samplingQc.BARCODE   = strarray[0]; //As BARCODE
                samplingQc.ITEM_ID   = strarray[1]; //As ITEM_ID
                samplingQc.ITEM_NAME = strarray[2]; //As ITEM_NAME
                samplingQc.NPK       = strarray[3]; //As QTY
                GlobalSamplingQC.Add(samplingQc);
                MessagingCenter.Send <MqttHelper, List <SamplingQC> >(this, MessagingCenterKeys.SamplingAdd_ServerToClientA, GlobalSamplingQC);
            }

            if (topic == "SamplingHeaderDokNo_ServerToClientA" + GlobalVar.MacAddress)
            {
                string[] strsplit = RecvMsg.Split(',');
                GlobalSamplingHeaderDokNo = new List <string>();

                List <string> strarray = new List <string>();

                foreach (string newstr in strsplit)
                {
                    strarray.Add(newstr);
                    GlobalSamplingHeaderDokNo.Add(newstr);

                    SamplingDokNo samplingDokNo = new SamplingDokNo();
                    samplingDokNo._documentno = newstr;
                    GlobalSamplingDokNo2.Add(samplingDokNo);
                }

                MessagingCenter.Send <MqttHelper, List <string> >(this, MessagingCenterKeys.SamplingHeaderDokNo_ServerToClientA, GlobalSamplingHeaderDokNo);
            }


            if (topic == "SamplingBarcode_ServerToClientA" + GlobalVar.MacAddress)
            {
                string[] strsplit = RecvMsg.Split(',');
                GlobalSamplingBarcode = new SamplingBarcode();

                List <string> strarray = new List <string>();

                foreach (string newstr in strsplit)
                {
                    strarray.Add(newstr); //Result: strarray[0] = BARCODE , strarray[1] = ITEM_ID , strarray[2] = ITEM_NAME
                }
                ////FORMAT => "BARCODE,ITEMID,ITEMNAME"
                ///
                GlobalSamplingBarcode.Barcode  = strarray[0];
                GlobalSamplingBarcode.ItemID   = strarray[1];
                GlobalSamplingBarcode.ItemName = strarray[2];

                MessagingCenter.Send <MqttHelper, SamplingBarcode>(this, MessagingCenterKeys.SamplingBarcode_ServerToClientA, GlobalSamplingBarcode);
            }


            if (topic == "SamplingOperator_ServerToClientA" + GlobalVar.MacAddress)
            {
                string[] strsplit = RecvMsg.Split(',');
                GlobalSamplingOperator = new SamplingOperator();

                List <string> strarray = new List <string>();

                foreach (string newstr in strsplit)
                {
                    strarray.Add(newstr); //Result: strarray[0] = NPK , strarray[1] = EmployeeName
                }
                ////FORMAT => "NPK,EmployeeName"
                ///
                GlobalSamplingOperator.NPK          = strarray[0];
                GlobalSamplingOperator.EmployeeName = strarray[1];

                MessagingCenter.Send <MqttHelper, SamplingOperator>(this, MessagingCenterKeys.SamplingOperator_ServerToClientA, GlobalSamplingOperator);
            }

            if (topic == "SamplingUserQC_ServerToClientA" + GlobalVar.MacAddress)
            {
                if (RecvMsg.Contains(","))
                {
                    string[] strsplit = RecvMsg.Split(',');
                    GlobalSamplingOperator = new SamplingOperator();
                    List <string> strarray = new List <string>();

                    foreach (string newstr in strsplit)
                    {
                        strarray.Add(newstr); //Result: strarray[0] = NPK , strarray[1] = EmployeeName
                    }
                    ////FORMAT => "NPK,EmployeeName"
                    ///
                    GlobalSamplingOperator.NPK          = strarray[0];
                    GlobalSamplingOperator.EmployeeName = strarray[1];
                    MessagingCenter.Send <MqttHelper, SamplingOperator>(this, MessagingCenterKeys.SamplingUserQC_ServerToClientA, GlobalSamplingOperator);
                }
                else
                {
                    GlobalSamplingOperator.NPK = RecvMsg;
                    MessagingCenter.Send <MqttHelper, SamplingOperator>(this, MessagingCenterKeys.SamplingUserQC_ServerToClientA, GlobalSamplingOperator);
                }
            }

            if (topic == "SamplingStatusSaveData_ServerToClientA" + GlobalVar.MacAddress)
            {
                if (RecvMsg.Contains("SUCCESSSAVE"))
                {
                    MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.SamplingStatusSaveData_ServerToClientA, "SUCCESSSAVE");
                }
                else
                {
                    MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.SamplingStatusSaveData_ServerToClientA, "FAILSAVE");
                }
            }

            if (topic == "SamplingReportSampling_ServerToClientA" + GlobalVar.MacAddress)
            {
                string[] strsplit = RecvMsg.Split(',');
                GlobalListReportSampling = new List <ReportSampling>();
                ReportSampling reportSamplings = new ReportSampling();

                int i = 0;
                foreach (string newstr in strsplit)
                {
                    if (i == 0)
                    {
                        reportSamplings           = new ReportSampling();
                        reportSamplings.BarcodeID = newstr;
                        i++;
                    }
                    else if (i == 1)
                    {
                        reportSamplings.EmployeeName = newstr;
                        i++;
                    }
                    else if (i == 2)
                    {
                        reportSamplings.SamplingTime = newstr;
                        i++;
                    }
                    else if (i == 3)
                    {
                        reportSamplings.ItemID = newstr;
                        i++;
                    }
                    else if (i == 4)
                    {
                        reportSamplings.ItemName = newstr;
                        i++;
                    }
                    else if (i == 5)
                    {
                        reportSamplings.Output = newstr;
                        GlobalListReportSampling.Add(reportSamplings);
                        i = 0;
                    }
                }
                MessagingCenter.Send <MqttHelper, List <ReportSampling> >(this, MessagingCenterKeys.SamplingReportSampling_ServerToClientA, GlobalListReportSampling);
            }

            if (topic == "LOGIN_AUTH_" + GlobalVar.MacAddress)
            {
                MessagingCenter.Send <MqttHelper, string>(this, MessagingCenterKeys.Login_Authorization, RecvMsg);
            }

            if (topic == "LOGIN_INFO_" + GlobalVar.MacAddress)
            {
                string[] strsplit = RecvMsg.Split(',');

                List <string> strarray = new List <string>();

                foreach (string newstr in strsplit)
                {
                    strarray.Add(newstr); //Result: strarray[0] = BARCODE , strarray[1] = ITEM_ID , strarray[2] = ITEM_NAME , strarray[3] = QTY
                }

                GlobalVar.EmployeeID   = strarray[0];
                GlobalVar.EmployeeName = strarray[1];
            }

            if (topic == "LOGIN_DIV_" + GlobalVar.MacAddress)
            {
                GlobalVar.Division = RecvMsg;
            }
        }
예제 #3
0
        private async void ToolbarSave_Clicked(object sender, EventArgs e)
        {
            /////////////////////////////////////////////////////////
            ///
            #region ToolBarAdd_Clicked
            //Validasi
            if (string.IsNullOrEmpty(textbox_BarcodeID.Text) || string.IsNullOrEmpty(textbox_ItemID.Text) || string.IsNullOrEmpty(textbox_ItemName.Text))
            {
                await DisplayAlert("Warning", "Barcode/Item Id/Item Name Empty", "OK");

                return;
            }

            string strJudge    = null;
            string strCriteria = null;
            if (!SwitchNG.IsToggled && Combobox_NG_SFusion.SelectedIndex < 0)
            {
                await DisplayAlert("Warning", "Criteria NG Empty", "OK");

                return;
            }

            if (SwitchNG.IsToggled)
            {
                strJudge    = "OK";
                strCriteria = "";
            }
            else
            {
                strJudge = "NG";
                List <string> listselectedNG = Combobox_NG_SFusion.SelectedValue as List <string>;
                foreach (var str in listselectedNG)
                {
                    strCriteria += str + "-";
                }
            }

            SamplingQC samplingQc = new SamplingQC();
            samplingQc.BARCODE      = textbox_BarcodeID.Text;
            samplingQc.ITEM_ID      = textbox_ItemID.Text;
            samplingQc.ITEM_NAME    = textbox_ItemName.Text;
            samplingQc.NPK          = "";
            samplingQc.EmployeeName = "";
            samplingQc.ScanDate     = DateTime.Now;
            samplingQc.Detail       = EntryDetail.Text;
            samplingQc.Judgement    = strJudge;
            samplingQc.Operator1    = textbox_Operator1NPK.Text;
            samplingQc.Operator2    = textbox_Operator2NPK.Text;
            samplingQc.Operator3    = textbox_Operator3NPK.Text;
            samplingQc.Operator4    = textbox_Operator4NPK.Text;
            samplingQc.Criteria     = strCriteria;

            listDetailSamplingQC = new List <SamplingQC>();
            listDetailSamplingQC.Add(samplingQc);

            Combobox_NG_SFusion.Text = "";
            #endregion
            ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\



            if (listDetailSamplingQC.Count <= 0)
            {
                await DisplayAlert("Warning", "Data Sampling Empty", "OK");

                return;
            }

            //if(Combobox_DokNo.SelectedIndex < 0)
            //{
            //    await DisplayAlert("Warning", "Dokumen No Empty", "OK");
            //    return;
            //}
            if (AppSettings.IsMqttConnected)
            {
                //await NavigateToScannerpageUserQC();


                //////////////////////////////////////////////////////////////////////////////////////////////////////
                ///
                ShownConfirmationSave = false;


                foreach (var item in listDetailSamplingQC)
                {
                    item.NPK          = GlobalVar.EmployeeID;
                    item.EmployeeName = GlobalVar.EmployeeName;
                }
                //string SamplingHeader = string.Format("*{0},{1}#", args.NPK, Combobox_DokNo.SelectedItem.ToString());
                string SamplingHeader = string.Format("*{0},{1}#", GlobalVar.EmployeeID, "REGULER");
                string strSampling    = null;
                string SamplingDetail = string.Format("~{0}@", strSampling);

                foreach (var item in listDetailSamplingQC)
                {
                    //string curSampling = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},", item.BARCODE, args.NPK, item.Judgement, item.Detail, Combobox_DokNo.SelectedItem.ToString(), item.Operator1, item.Operator2, item.Operator3, item.Operator4, item.Criteria);
                    string curSampling = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},", item.BARCODE, GlobalVar.EmployeeID, item.Judgement, item.Detail, "REGULER", item.Operator1, item.Operator2, item.Operator3, item.Operator4, item.Criteria);
                    strSampling = strSampling + curSampling;
                }
                SamplingDetail = string.Format("~{0}@{1}$", strSampling, GlobalVar.PlantID);
                string PubMsg = string.Format("{2}{0}{1}", SamplingHeader, SamplingDetail, GlobalVar.MacAddress);///Format *SamplingHeader#~Sampling@
                if (AppSettings.IsMqttConnected)
                {
                    _application.mqttHelper.PublishMQTT(PubMsg, "SamplingSaveData_ClientAToServer");
                }
                else
                {
                    await DisplayAlert("Warning", "Your Connection has been Disconnected. Please Try Again.", "OK");

                    return;
                }

                ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
            }
        }