Exemplo n.º 1
0
 public Client_CountingSession(Accessory accessory, Pack pack, CountingSession countingSession)
 {
     CountingSessionPK    = countingSession.CountingSessionPK;
     ExecutedDate         = countingSession.ExecutedDate;
     AccessoryID          = accessory.AccessoryID;
     AccessoryDescription = accessory.AccessoryDescription;
     Art    = accessory.Art;
     Color  = accessory.Color;
     Item   = accessory.Item;
     PackID = pack.PackID;
 }
 internal void createCountingSession(CountingSession countingSession)
 {
     try
     {
         db.CountingSessions.Add(countingSession);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 internal void deleteCountingSession(int countingSessionPK)
 {
     try
     {
         CountingSession countingSession = db.CountingSessions.Find(countingSessionPK);
         db.CountingSessions.Remove(countingSession);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public Client_CountingSessionDetail(Accessory accessory, Pack pack, CountingSession countingSession, IdentifiedItem identifiedItem, Box box, PackedItem packedItem)
 {
     CountingSessionPK    = countingSession.CountingSessionPK;
     ExecutedDate         = countingSession.ExecutedDate;
     CountedQuantity      = countingSession.CountedQuantity;
     IdentifiedQuantity   = identifiedItem.IdentifiedQuantity;
     AccessoryID          = accessory.AccessoryID;
     AccessoryDescription = accessory.AccessoryDescription;
     Art          = accessory.Art;
     Color        = accessory.Color;
     Item         = accessory.Item;
     PackID       = pack.PackID;
     BoxID        = box.BoxID;
     IsClassified = packedItem.IsClassified;
 }
 public void updateCountingSession(int countingSessionPK, double countedQuantity)
 {
     try
     {
         CountingSession countingSession = db.CountingSessions.Find(countingSessionPK);
         countingSession.CountedQuantity = countedQuantity;
         countingSession.ExecutedDate    = DateTime.Now;
         db.Entry(countingSession).State = EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 6
0
        public void IsInitAllCalculate(int packedItemPK)
        {
            try
            {
                double tempSample      = 0;
                double tempDefectLimit = 0;
                List <IdentifiedItem> identifiedItems = (from iI in db.IdentifiedItems
                                                         where iI.PackedItemPK == packedItemPK
                                                         select iI).ToList();
                foreach (var item in identifiedItems)
                {
                    // init session
                    CountingSession countingSession = (from countss in db.CountingSessions
                                                       where countss.IdentifiedItemPK == item.IdentifiedItemPK
                                                       select countss).FirstOrDefault();
                    CheckingSession checkingSession = (from checkss in db.CheckingSessions
                                                       where checkss.IdentifiedItemPK == item.IdentifiedItemPK
                                                       select checkss).FirstOrDefault();

                    // assign value to variable
                    tempSample              += item.IdentifiedQuantity;
                    tempDefectLimit         += item.IdentifiedQuantity;
                    SumOfIdentifiedQuantity += item.IdentifiedQuantity;
                    if (countingSession != null)
                    {
                        SumOfCountedQuantity += countingSession.CountedQuantity;
                    }
                    if (checkingSession != null)
                    {
                        SumOfUnqualifiedQuantity += checkingSession.UnqualifiedQuantity;
                        SumOfCheckedQuantity     += checkingSession.CheckedQuantity;
                    }
                }
                Sample      = SampleCaculate(tempSample);
                DefectLimit = DefectLimitCaculate(tempDefectLimit);
            }
            catch (Exception e)
            {
                throw new Exception("HÀM TÍNH SAMPLE VÀ DEFECT LIMIT BỊ LỖI");
            }
        }
Exemplo n.º 7
0
        public double FinalQuantity(int packedItemPK)
        {
            double result = 0;

            try
            {
                List <IdentifiedItem> identifiedItems = (from iI in db.IdentifiedItems
                                                         where iI.PackedItemPK == packedItemPK
                                                         select iI).ToList();
                foreach (var item in identifiedItems)
                {
                    int             numCase         = 0;
                    CheckingSession checkingSession = (from checkss in db.CheckingSessions
                                                       where checkss.IdentifiedItemPK == item.IdentifiedItemPK
                                                       select checkss).FirstOrDefault();
                    CountingSession countingSession = (from countss in db.CountingSessions
                                                       where countss.IdentifiedItemPK == item.IdentifiedItemPK
                                                       select countss).FirstOrDefault();
                    if (item.IsChecked == false && item.IsCounted == false)
                    {
                        numCase = 1;
                    }
                    if (item.IsChecked == false && item.IsCounted == true)
                    {
                        numCase = 2;
                    }
                    if (item.IsChecked == true && item.IsCounted == false)
                    {
                        numCase = 3;
                    }
                    if (item.IsChecked == true && item.IsCounted == true)
                    {
                        if (checkingSession.ExecutedDate < countingSession.ExecutedDate)
                        {
                            numCase = 4;
                        }
                        else
                        {
                            numCase = 5;
                        }
                    }
                    switch (numCase)
                    {
                    case 1:
                        result += item.IdentifiedQuantity;
                        break;

                    case 2:
                        result += countingSession.CountedQuantity;
                        break;

                    case 3:
                        result += item.IdentifiedQuantity - checkingSession.UnqualifiedQuantity;
                        break;

                    case 4:
                        result += countingSession.CountedQuantity;
                        break;

                    case 5:
                        result += countingSession.CountedQuantity - checkingSession.UnqualifiedQuantity;
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return(result);
        }