示例#1
0
        private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            storingList   = StoringController.SelectIsNotLoad();
            outputingList = OutputingController.SelectIsNotLoad();

            if (outputingList.Count > 0)
            {
                foreach (var outputInDB in outputingList)
                {
                    OutputingCurrent current = new OutputingCurrent();
                    current.Outputing = outputInDB;
                    outputingCurrentList.Add(current);
                }
            }
            else
            {
                OutputingModel outputingDefault = new OutputingModel()
                {
                    ProductNo         = "Default",
                    Barcode           = "Default",
                    SizeNo            = "Default",
                    CartonNo          = 0,
                    GrossWeight       = 0,
                    ActualWeight      = 0,
                    DifferencePercent = 0,
                    IsPass            = false,
                    WorkerId          = "Default",
                    IssuesId          = 0
                };

                OutputingCurrent currentDefault = new OutputingCurrent();
                currentDefault.Outputing = outputingDefault;
                outputingCurrentList.Add(currentDefault);
            }
        }
示例#2
0
        private void bwReport_DoWork(object sender, DoWorkEventArgs e)
        {
            string productNo = e.Argument.ToString();
            List <CartonNumberingModel>       cartonNumberingList       = CartonNumberingController.Get(productNo).ToList();
            List <CartonNumberingDetailModel> cartonNumberingDetailList = CartonNumberingDetailController.Select(productNo);
            List <StoringModel> storingList = StoringController.SelectPerPO(productNo);

            DataTable dtCartonNumbering = new CartonNumberingDataSet().Tables[0];
            DataTable dtStoring         = new StoringReportDataSet().Tables[0];

            foreach (CartonNumberingModel cartonNumbering in cartonNumberingList)
            {
                DataRow drCartonNumbering = dtCartonNumbering.NewRow();
                drCartonNumbering["ProductNo"] = cartonNumbering.ProductNo;
                drCartonNumbering["SizeNo"]    = cartonNumbering.SizeNo;
                drCartonNumbering["Quantity"]  = cartonNumbering.Quantity;
                StoringModel storingPerSize = storingList.Where(p => p.SizeNo == cartonNumbering.SizeNo).FirstOrDefault();
                if (storingPerSize != null)
                {
                    drCartonNumbering["GrossWeight"]       = storingPerSize.ActualWeight;
                    drCartonNumbering["FirstCartonOfSize"] = storingPerSize.CartonNo;
                }

                dtCartonNumbering.Rows.Add(drCartonNumbering);

                List <CartonNumberingDetailModel> cartonNumberingDetail_D1 = cartonNumberingDetailList.Where(c => c.SizeNo == cartonNumbering.SizeNo).ToList();
                for (int i = 1; i <= cartonNumberingDetail_D1.Count(); i++)
                {
                    CartonNumberingDetailModel cartonNumberingDetail = cartonNumberingDetail_D1[i - 1];
                    StoringModel storing = storingList.Where(p => p.CartonNo == cartonNumberingDetail.CartonNo).FirstOrDefault();

                    DataRow drStoring = dtStoring.NewRow();
                    drStoring["ProductNo"]    = cartonNumberingDetail.CartonNo;
                    drStoring["ProductNo"]    = cartonNumbering.ProductNo;
                    drStoring["SizeNo"]       = cartonNumbering.SizeNo;
                    drStoring["NumberOf"]     = i;
                    drStoring["StoringValue"] = string.Format("{0} |", cartonNumberingDetail.CartonNo);
                    if (storing != null)
                    {
                        drStoring["StoringValue"] = string.Format("{0} | {1}", cartonNumberingDetail.CartonNo, storing.ActualWeight);

                        drStoring["IsPass"] = storing.IsPass;
                    }
                    dtStoring.Rows.Add(drStoring);
                }
            }
            string storingDate    = "";
            string quantityCarton = "";

            if (storingList.Count() > 0 && cartonNumberingDetailList.Count() > 0)
            {
                storingDate    = string.Format("{0:dd/MM/yyyy}", storingList.FirstOrDefault().CreatedTime);
                quantityCarton = string.Format("{0} of {1}", storingList.Count(), cartonNumberingDetailList.Select(s => s.CartonNo).Max());
            }
            double totalWeight = storingList.Sum(p => p.ActualWeight);

            object[] results = { productNo, storingDate, dtCartonNumbering, dtStoring, totalWeight, quantityCarton };
            e.Result = results;
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            // Input
            double actualWeight = 0;
            int    cartonNo     = 0;

            Double.TryParse(txtActualWeight.Text.ToString(), out actualWeight);
            Int32.TryParse(txtCartonNo.Text.ToString(), out cartonNo);
            string sizeNo = txtSizeNo.Text.ToString();

            // Output

            if (mode == 1)
            {
                var overrideOutputCarton = receiveOutputModel;
                overrideOutputCarton.ActualWeight      = actualWeight;
                overrideOutputCarton.CartonNo          = cartonNo;
                overrideOutputCarton.SizeNo            = sizeNo;
                overrideOutputCarton.IsPass            = true;
                overrideOutputCarton.GrossWeight       = 0;
                overrideOutputCarton.DifferencePercent = 0;
                overrideOutputCarton.IssuesId          = 0;
                if (OutputingController.Insert(overrideOutputCarton) == false)
                {
                    MessageBox.Show("Error occurred!", "Infor", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                outputingCurrent = overrideOutputCarton;
            }

            if (mode == 2)
            {
                var overrideStoringCarton = receiveStoringModel;

                overrideStoringCarton.ActualWeight      = actualWeight;
                overrideStoringCarton.CartonNo          = cartonNo;
                overrideStoringCarton.SizeNo            = sizeNo;
                overrideStoringCarton.IsPass            = true;
                overrideStoringCarton.GrossWeight       = 0;
                overrideStoringCarton.DifferencePercent = 0;
                overrideStoringCarton.IssuesId          = 0;
                if (StoringController.Insert(overrideStoringCarton) == false)
                {
                    MessageBox.Show("Error occurred!", "Infor", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                storingCurrent = overrideStoringCarton;
            }
            MessageBox.Show("Thùng Đã Được Pass!\nPASSED!", "Infor", MessageBoxButton.OK, MessageBoxImage.Information);
            btnSave.IsEnabled           = false;
            groupUpdateCarton.IsEnabled = false;

            Thread.Sleep(2000);
            this.Close();
        }
        private void bwSave_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (controlAccount == null)
            {
                MessageBox.Show(string.Format("Wrong Security Code !"), "Infor", MessageBoxButton.OK, MessageBoxImage.Error);
                txtPassword.Focus();
                txtPassword.SelectAll();
                btnSave.IsEnabled = true;

                return;
            }

            //Create Log
            string logBodyOldCarton = "Production No.: {0}, Size No.: {1}, Carton No.: {2}, Gross Weight: {3}kg, Actual Weight: {4}kg, Difference Percent: {5}%, Created By: {6}";

            LogHelper.CreateLog(string.Format(logBodyOldCarton, storingPerBarcode.ProductNo, storingPerBarcode.SizeNo, storingPerBarcode.CartonNo, storingPerBarcode.GrossWeight, storingPerBarcode.ActualWeight, storingPerBarcode.DifferencePercent, controlAccount.FullName));

            // Update DB
            StoringModel reWeighModel = new StoringModel();

            reWeighModel = storingPerBarcode;
            reWeighModel.ActualWeight = newWeight;

            if (StoringController.Insert(reWeighModel) == true)
            {
                Thread.Sleep(1500);
                MessageBox.Show(string.Format("Saved !"), "Infor", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show(string.Format("An Error Occur!"), "Infor", MessageBoxButton.OK, MessageBoxImage.Error);
            }


            this.Cursor       = null;
            btnSave.IsEnabled = true;

            txtProductNo.Text = "";
            txtSizeNo.Text    = "";
            txtCartonNo.Text  = "";

            txtNewWeight.Text = "0";
            txtOldWeight.Text = "0";

            txtBarcode.Focus();
            txtBarcode.SelectAll();
            btnBarcode.IsEnabled = true;
            btnBarcode.IsDefault = true;

            txtPassword.Password  = "";
            stkConfirm.Visibility = Visibility.Collapsed;
        }
示例#5
0
        private void InsertCarton()
        {
            double actualWeightFirstCarton = 0;

            Double.TryParse(tblActualWeight.Tag.ToString(), out actualWeightFirstCarton);
            var modelInsert = new StoringModel()
            {
                ProductNo         = productNo,
                Barcode           = barcode,
                SizeNo            = sizeNo,
                CartonNo          = cartonNo,
                ActualWeight      = actualWeightFirstCarton,
                GrossWeight       = 0,
                IsComplete        = completeCarton,
                DifferencePercent = 0,
                IsPass            = true,
                IssuesId          = 0,
                WorkerId          = account.UserName,
            };

            StoringController.Insert(modelInsert);
            if (completeCarton == true)
            {
                DefaultStatus();
            }
            else
            {
                IncompleteStatus();
            }

            // Highlight
            tblResult.Dispatcher.Invoke(new Action(() =>
            {
                tblResult.Foreground = Brushes.White;
                tblResult.Text       = string.Format("{0} - Add", modelInsert.CartonNo);
            }));
            brResult.Dispatcher.Invoke(new Action(() =>
            {
                brResult.Background = Brushes.Green;
            }));

            StoringCurrent insertCurrent = new StoringCurrent();

            insertCurrent.StoringModel = modelInsert;
            storingCurrentList.Add(insertCurrent);
        }
示例#6
0
        private void dispatcherTimerSendReport_Tick(object sender, EventArgs e)
        {
            var currentTime = DateTime.Now;

            if (currentTime.Hour == createReportHour && currentTime.Minute == createReportMinute && currentTime.Second == createReportSecond)
            {
                var storingReportPerDateList = new List <StoringModel>();
                storingReportPerDateList = StoringController.SelectByDate(DateTime.Now, account.UserName);
                if (storingReportPerDateList.Count > 0)
                {
                    // Send Email
                    mailAddressReceiveMessageList = MailAddressReceiveMessageController.Get();
                    foreach (MailAddressReceiveMessageModel mailAddressReceiveMessage in mailAddressReceiveMessageList)
                    {
                        MailAddress mailAddressReceive = new MailAddress(mailAddressReceiveMessage.MailAddress, mailAddressReceiveMessage.Name);
                        mailMessage.To.Add(mailAddressReceive);
                    }

                    string mailHeader = @"<html><table border='1' style='width:75%'>
                                    <tr><td style='width:20%'>ProductNo</td><td style='width:15%'>Total</td><td style='width:15%'>Inputted</td><td style='width:15%'>Total Inputted</td><td style='width:15%'>Balance</td><td style='width:20%'>Location</td></tr>";
                    string mailBody   = "";
                    foreach (var productNo in storingReportPerDateList.Select(s => s.ProductNo).Distinct().ToList())
                    {
                        //int total = storingTempList.Where(w => w.ProductNo == productNo).Select(s => s.CartonNo).Max();
                        int total    = CartonNumberingDetailController.Select(productNo).Select(s => s.CartonNo).Max();
                        int inputted = storingReportPerDateList.Where(w => w.ProductNo == productNo && w.IsPass == true && w.IsComplete == true).Count();
                        //int totalInputed = storingCurrentList.Where(w => w.StoringModel.ProductNo == productNo && w.StoringModel.IsPass == true && w.StoringModel.IsComplete == true).Count();
                        int totalInputted = StoringController.SelectPerPO(productNo).Where(w => w.IsPass == true && w.IsComplete == true).Count();
                        int balance       = total - totalInputted;
                        mailBody += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr>",
                                                  productNo, total, inputted, totalInputted, balance, electricScaleProfile.Location);
                    }
                    mailMessage.Body = mailHeader + mailBody + "</table></html>";

                    if (flagSending == false && mailMessage.To.Count > 0 && CheckInternetConnection.CheckConnection() == true)
                    {
                        smtpClient.SendAsync(mailMessage, mailMessage);
                        flagSending = true;
                        MessageBox.Show(String.Format("Đã gửi report ngày: {0:dd/MM/yyyy HH:mm:ss}", DateTime.Now), "Infor", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
            }
        }
 private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
 {
     storingPerBarcode = StoringController.SelectByBarcode(barcode);
 }
示例#8
0
        private void CompareWeight()
        {
            var currentCarton = new StoringModel()
            {
                ProductNo  = productNo,
                Barcode    = barcode,
                SizeNo     = sizeNo,
                CartonNo   = cartonNo,
                WorkerId   = account.UserName,
                IsComplete = true,
            };

            // get gross weight of the carton has same size with this carton.
            tblGrossWeight.Text = string.Format("{0}", firstCarton_Size_PO.ActualWeight);
            tblGrossWeight.Tag  = string.Format("{0}", firstCarton_Size_PO.ActualWeight);

            double grossWeight = 0;

            Double.TryParse(tblGrossWeight.Tag.ToString(), out grossWeight);
            double actualWeight = 0;

            Double.TryParse(tblActualWeight.Tag.ToString(), out actualWeight);

            if (grossWeight <= 0)
            {
                grossWeight = actualWeight;
            }

            currentCarton.GrossWeight  = grossWeight;
            currentCarton.ActualWeight = actualWeight;
            double percentDifference = actualWeight / grossWeight;

            tblDifferencePercent.Dispatcher.Invoke(new Action(() =>
                                                              tblDifferencePercent.Text = string.Format("{0}", Math.Round(100 * (percentDifference - 1), 2))
                                                              ));
            currentCarton.DifferencePercent = Math.Round(100 * (percentDifference - 1), 2);

            // if carton is OK
            if (percentDifference >= LIMITED_MIN && percentDifference <= LIMITED_MAX)
            {
                tblResult.Dispatcher.Invoke(new Action(() =>
                {
                    tblResult.Foreground = Brushes.White;
                    tblResult.Text       = string.Format("{0} - Pass", currentCarton.CartonNo);
                }));
                brResult.Dispatcher.Invoke(new Action(() =>
                {
                    brResult.Background = Brushes.Green;
                }));
                currentCarton.IsPass   = true;
                currentCarton.IssuesId = 0;

                StoringController.Insert(currentCarton);

                StoringCurrent storingCurrentModel = new StoringCurrent();
                storingCurrentModel.StoringModel = currentCarton;
                storingCurrentList.Add(storingCurrentModel);
            }
            // If current carton has problem (the weight is lower or higher than firstcarton)
            else
            {
                // Show highlight.
                if (percentDifference < LIMITED_MIN)
                {
                    tblResult.Dispatcher.Invoke(new Action(() =>
                    {
                        tblResult.Foreground = Brushes.Black;
                        tblResult.Text       = string.Format("{0} - Low", currentCarton.CartonNo);
                    }));
                    brResult.Dispatcher.Invoke(new Action(() =>
                    {
                        brResult.Background = Brushes.Yellow;
                    }));
                }
                else
                {
                    tblResult.Dispatcher.Invoke(new Action(() =>
                    {
                        tblResult.Foreground = Brushes.White;
                        tblResult.Text       = string.Format("{0} - Hi", currentCarton.CartonNo);
                    }));
                    brResult.Dispatcher.Invoke(new Action(() =>
                    {
                        brResult.Background = Brushes.Red;
                    }));
                }
                // tranfer this model to check problem, after that insert to db
                currentCarton.IsPass = false;
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    CheckIssuesWindow window = new CheckIssuesWindow(null, currentCarton, IssuesType.Issues.IssuesCompareWeight, factory);
                    window.ShowDialog();

                    StoringModel storingRecieve = window.storingCurrent;

                    StoringCurrent storingCurrent = new StoringCurrent();
                    storingCurrent.StoringModel   = storingRecieve;

                    storingCurrentList.Add(storingCurrent);
                }));
            }
            DefaultStatus();
        }
示例#9
0
        private void bwLoad_DoWork(object sender, DoWorkEventArgs e)
        {
            storingWeighedList = StoringController.SelectIsNotLoad();
            outputtedList      = OutputingController.SelectIsNotLoad();

            int storingIndex = 1;

            foreach (StoringModel storing in storingWeighedList)
            {
                var current = new StoringCurrent()
                {
                    StoringModel = storing,
                };
                storingCurrentList.Add(current);

                Dispatcher.Invoke(new Action(() =>
                {
                    tempTitle  = string.Format("Downloading Carton: {0} / {1}", storingIndex, storingWeighedList.Count);
                    this.Title = tempTitle;
                }));

                storingIndex++;
            }

            // If this carton was outputted, allow reweigh
            if (outputtedList.Count > 0)
            {
                var barcodeOutputedList = outputtedList.Select(s => s.Barcode).Distinct().ToList();
                storingCurrentList.RemoveAll(r => barcodeOutputedList.Contains(r.StoringModel.Barcode));
            }

            var POScannedList = storingWeighedList.Where(w => w.Barcode.Contains(",") == false).Select(s => s.ProductNo).Distinct().ToList();

            // Create barcode temp
            int poCreatedIndex = 1;

            foreach (var PO in POScannedList)
            {
                var cartonNumberingDetail_POScannedList = CartonNumberingDetailController.Select(PO);
                // If total carton current in po equals total carton in cartonnumberingdetail. PO will be ignore.
                if (storingWeighedList.Where(w => w.ProductNo == PO).Count() == cartonNumberingDetail_POList.Count())
                {
                    poCreatedIndex++;
                    continue;
                }
                var firstStoringWeighedList = storingWeighedList.Where(w => w.ProductNo == PO).FirstOrDefault();
                int serialCarton_0          = ConvertBarcodeToSerial(firstStoringWeighedList.Barcode) - firstStoringWeighedList.CartonNo;
                int cartonIndex             = 1;
                foreach (var cartonDetail in cartonNumberingDetail_POScannedList)
                {
                    var storingTemp = new StoringTemp()
                    {
                        SizeNo    = cartonDetail.SizeNo,
                        ProductNo = cartonDetail.ProductNo,
                        CartonNo  = cartonDetail.CartonNo,
                        SerialNo  = serialCarton_0 + cartonDetail.CartonNo,
                    };
                    storingTempList.Add(storingTemp);

                    Dispatcher.Invoke(new Action(() =>
                    {
                        tempTitle = String.Format("Creating Barcode: {0} of {1} for {2} / {3} PO#",
                                                  cartonIndex,
                                                  cartonNumberingDetail_POScannedList.Select(s => s.CartonNo).Max(),
                                                  poCreatedIndex,
                                                  POScannedList.Count);
                        this.Title = tempTitle;
                    }));

                    cartonIndex++;
                }
                poCreatedIndex++;
            }
        }
示例#10
0
 //string gtnPONo = "", totalCartonInputedString = "", totalWeightString = "";
 private void bwReport_DoWork(object sender, DoWorkEventArgs e)
 {
     outputingPerPOList = OutputingController.SelectPerPO(productNo).OrderBy(o => o.CartonNo).ToList();
     storingPerPOList   = StoringController.SelectPerPO(productNo).OrderBy(o => o.CartonNo).ToList();
     accountList        = AccountController.Get();
 }
        private void bwInsertAndSendEmail_DoWork(object sender, DoWorkEventArgs e)
        {
            // Send Email
            mailAddressReceiveMessageList = MailAddressReceiveMessageController.Get();
            foreach (MailAddressReceiveMessageModel mailAddressReceiveMessage in mailAddressReceiveMessageList)
            {
                MailAddress mailAddressReceive = new MailAddress(mailAddressReceiveMessage.MailAddress, mailAddressReceiveMessage.Name);
                mailMessage.To.Add(mailAddressReceive);
            }

            string reason = "";

            reason = issuesList.Where(w => w.IssuesId == issuesId).Select(s => s.IssuesName).FirstOrDefault().ToString();
            string mailBody = "";

            // OUTPUT PROMBLEM
            if (receiveOutputModel != null)
            {
                mode = 1;
                receiveOutputModel.IssuesId = issuesId;
                // InsertDB
                if (OutputingController.Insert(receiveOutputModel) == false)
                {
                    MessageBox.Show("Insert Error!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                //CreatedLog
                string logBodyOldCarton = "Production No.: {0}, Size No.: {1}, Carton No.: {2}, Gross Weight: {3}kg, Actual Weight: {4}kg, Difference Percent: {5}%, Created By: {6}, Reason :{7}, Location {8}";
                LogHelper.CreateOutputLog(string.Format(logBodyOldCarton, receiveOutputModel.ProductNo, receiveOutputModel.SizeNo, receiveOutputModel.CartonNo, receiveOutputModel.GrossWeight, receiveOutputModel.ActualWeight, receiveOutputModel.DifferencePercent, findControlAccountModel.FullName, reason, electricScaleProfile.Location));

                // Created Email
                mailBody = @"<html><table border='1' style='width:100%'>
                                    <tr><td>ProductNo</td><td>SizeNo</td><td>CartonNo</td><td>Gross Weight</td><td>Actual Weight</td><td>Difference Percent</td><td>Check By</td><td>Location</td><td>Reason</td></tr>
                                    <tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3} kg</td><td>{4} kg</td><td>{5} %</td><td>{6}</td><td>{7}</td><td>{8}</td></tr>
                                    </table></html>";
                //string logBody = "Production No.:{0} Size No.:{1} Carton No.:{2} Gross Weight:{3}kg Actual Weight: {4}kg Difference Percent:{5}% Check by:{6} Reason:{7}";
                mailMessage.Subject = string.Format("STORING SYSTEM - OUTPUT PROMBLEM");
                mailMessage.Body    = string.Format(mailBody, receiveOutputModel.ProductNo, receiveOutputModel.SizeNo, receiveOutputModel.CartonNo, receiveOutputModel.GrossWeight, receiveOutputModel.ActualWeight, receiveOutputModel.DifferencePercent, findControlAccountModel.FullName, electricScaleProfile.Location, reason);

                outputingCurrent = receiveOutputModel;
            }

            // INPUT PROBLEM
            if (receiveStoringModel != null)
            {
                mode = 2;

                receiveStoringModel.IssuesId = issuesId;
                if (StoringController.Insert(receiveStoringModel) == false)
                {
                    MessageBox.Show("Insert Error!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                if (issuesType == IssuesType.Issues.IssuesFirstCartonOfSizeOfPO)
                {
                    mailBody         = @"<html><table border='1' style='width:100%'>
                                    <tr><td>ProductNo</td><td>SizeNo</td><td>CartonNo</td><td>Check By</td><td>Location</td><td>Reason</td></tr>
                                    <tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td></tr>
                                    </table></html>";
                    mailMessage.Body = string.Format(mailBody, receiveStoringModel.ProductNo, receiveStoringModel.SizeNo, receiveStoringModel.CartonNo, findControlAccountModel.FullName, electricScaleProfile.Location, reason);
                    //string logBody = "Production No.:{0} Size No.:{1} Carton No.:{2} Gross Weight:{3}kg Actual Weight: {4}kg Difference Percent:{5}% Check by:{6} Reason:{7}";
                    mailMessage.Subject = string.Format("STORING SYSTEM - INPUT PROBLEM - FIRST CARTON");
                }

                if (issuesType == IssuesType.Issues.IssuesCompareWeight)
                {
                    mailBody = @"<html><table border='1' style='width:100%'>
                                    <tr><td>ProductNo</td><td>SizeNo</td><td>CartonNo</td><td>Gross Weight</td><td>Actual Weight</td><td>Difference Percent</td><td>Check By</td><td>Location</td><td>Reason</td></tr>
                                    <tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3} kg</td><td>{4} kg</td><td>{5} %</td><td>{6}</td><td>{7}</td><td>{8}</td></tr>
                                    </table></html>";
                    //string logBody = "Production No.:{0} Size No.:{1} Carton No.:{2} Gross Weight:{3}kg Actual Weight: {4}kg Difference Percent:{5}% Check by:{6} Reason:{7}";
                    mailMessage.Subject = string.Format("STORING SYSTEM - INPUT PROMBLEM - WEIGHT");
                    mailMessage.Body    = string.Format(mailBody, receiveStoringModel.ProductNo, receiveStoringModel.SizeNo, receiveStoringModel.CartonNo, receiveStoringModel.GrossWeight, receiveStoringModel.ActualWeight, receiveStoringModel.DifferencePercent, findControlAccountModel.FullName, electricScaleProfile.Location, reason);

                    string logBodyOldCarton = "Production No.: {0}, Size No.: {1}, Carton No.: {2}, Gross Weight: {3}kg, Actual Weight: {4}kg, Difference Percent: {5}%, Created By: {6}, Reason :{7}, Location {8}";
                    LogHelper.CreateIssuesLog(string.Format(logBodyOldCarton, receiveStoringModel.ProductNo, receiveStoringModel.SizeNo, receiveStoringModel.CartonNo, receiveStoringModel.GrossWeight, receiveStoringModel.ActualWeight, receiveStoringModel.DifferencePercent, findControlAccountModel.FullName, reason, electricScaleProfile.Location));
                }
                storingCurrent = receiveStoringModel;
            }

            if (flagSending == false && mailMessage.To.Count > 0)
            {
                if (CheckInternetConnection.CheckConnection() == false)
                {
                    MessageBox.Show("Không có kết nối Internet!\nNo Internet Connection!", "Info", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }
                smtpClient.SendAsync(mailMessage, mailMessage);
                flagSending = true;
                MessageBox.Show("Đã gửi Email!\nSent Email!", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }