Example #1
0
        public static List <int> BuildSmallestHeaviestPalletA(List <int> totalPallet)
        {
            var minimumPalletSize = 2;
            var originalPallet    = new Pallet(totalPallet);

            // Tests Pallets
            //var listA = new List<int>() { originalPallet.Boxes[0], originalPallet.Boxes[1] };
            //var listB = new List<int>() { originalPallet.Boxes[2], originalPallet.Boxes[3], originalPallet.Boxes[4] };
            //var palletA = new Pallet(listA.Count, listA);
            //var palletB = new Pallet(listB.Count, listB);

            Pallet SmallestHeaviestPallet = BuildSmallestHeaviestPalletA(originalPallet, minimumPalletSize);

            return(SmallestHeaviestPallet.Boxes);
        }
Example #2
0
        private static void CreatePart(Pallet pallet, string reference)
        {
            var productionOrder = ProductionOrderRepository.GetActiveByPallet(pallet);

            var part = new Part
            {
                ProductionOrder = productionOrder,
                FabricationDate = DateTime.Now,
                Reference       = reference
            };

            productionOrder.ActivePart = part;
            PartRepository.SaveOrUpdate(part);
            ProductionOrderRepository.SaveOrUpdate(part.ProductionOrder);
        }
Example #3
0
        public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
        {
            if (0 == cbType.Items.Count)
            {
                return;
            }
            PalletProperties palletProperties = new PalletProperties(null, PalletTypeName, PalletLength, PalletWidth, PalletHeight)
            {
                Color = PalletColor
            };
            Pallet pallet = new Pallet(palletProperties);

            pallet.Draw(graphics, Transform3D.Identity);
            graphics.AddDimensions(new DimensionCube(PalletLength, PalletWidth, PalletHeight));
        }
Example #4
0
    //cuando llega a la cinta
    public void LlegadaPallet(Pallet p)
    {
        PEnMov = null;
        Contador--;

        Pj.Dinero += (int)Bonus;

        if (Contador <= 0)
        {
            Finalizacion();
        }
        else
        {
            Est2.EncenderAnim();
        }
    }
Example #5
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     if (0 == Mode)
     {
         Pallet pallet = new Pallet(PalletProperties);
         pallet.Draw(graphics, Transform3D.Identity);
         graphics.AddDimensions(new DimensionCube(PalletLength, PalletWidth, PalletHeight));
     }
     else
     {
         Truck truck = new Truck(TruckProperties);
         truck.DrawBegin(graphics);
         truck.DrawEnd(graphics);
         graphics.AddDimensions(new DimensionCube(TruckLength, TruckWidth, TruckHeight));
     }
 }
Example #6
0
        private void CreateModels(ModelInfo database, TsmDossier dossier, Pallet pallet)
        {
            CodeWriter cw = new CodeWriter();

            cw.WriteLine($@"import {{ JsonObject, JsonProperty }} from ""json2typescript"";");
            cw.WriteLine($@"import * as enumerations from  ""./Enumerations"";");

            TsmEntityMold tableMold = new TsmEntityMold();

            foreach (EntityInfo table in database.Entities.OrderByDescending(e => e.Order).ThenBy(e => e.Name))
            {
                tableMold.CreateDataclass(cw, database, table, dossier, pallet);
            }

            pallet.AddProduct("TsmModel", "Models", $@"Models.ts", cw);
        }
Example #7
0
        public ItemDetailPage()
        {
            InitializeComponent();

            var item = new Pallet
            {
                Id          = 2,
                Status      = "Status",
                SentDate    = "12/12/2020",
                StoreId     = 123,
                WrappedDate = "12/12/2020"
            };

            viewModel      = new ItemDetailViewModel(item);
            BindingContext = viewModel;
        }
Example #8
0
        //update one Pallet into Pallet table
        public static List <Pallet> UpdatePallet(Pallet e)
        {
            var model1 = (from pallet in db.Pallets
                          where pallet.SalesOrder.Contains(e.SalesOrder) & pallet.ItemID.Equals(e.ItemID)
                          select pallet).SingleOrDefault();

            model1.ItemID      = e.ItemID;
            model1.SalesOrder  = e.SalesOrder;
            model1.ShipCity    = e.ShipCity;
            model1.ShippedDate = e.ShippedDate;
            model1.ShipState   = e.ShipState;
            model1.ShipVia     = e.ShipVia;
            model1.TrackingNo  = e.TrackingNo;
            db.SaveChanges();
            return(GetAllPallets());
        }
Example #9
0
    ////////////////////////////////////////////////////////
    /// LIFT MANAGEMENT
    ////////////////////////////////////////////////////////

    private bool CanLift()
    {
        if (BottomPallet == null)
        {
            return(true);
        }

        Pallet p = BottomPallet.GetComponent <Pallet>();

        if (p.StackedPallet != null)
        {
            return(false);
        }

        return(true);
    }
Example #10
0
        private void viewScannedInfo(Pallet p)
        {
            DataRow dr = clDtGriData.NewRow();

            //check if datagrid is empty
            if (clDtGriData.Rows.Count == 0)
            {
                dr["EAN128ID"]    = p.ean128;
                dr["Quantity"]    = p.quantity;
                dr["NetWeight"]   = p.netweight;
                dr["Client"]      = p.clientname;
                dr["DateScanned"] = p.datescanned;
                dr["ExpiryDate"]  = p.expdat;
                dr["Category"]    = p.FroChill;

                clDtGriData.Rows.Add(dr);
                clDtGriData.AcceptChanges();

                dataGridView.DataSource = clDtGriData;
            }
            //if not empty, then check if the barcode scanned has the same or different client as the previously scanned client
            else
            {
                string cname = clDtGriData.Rows[0]["Client"].ToString();

                if (cname == p.clientname)
                {
                    dr["EAN128ID"]    = p.ean128;
                    dr["Quantity"]    = p.quantity;
                    dr["NetWeight"]   = p.netweight;
                    dr["Client"]      = p.clientname;
                    dr["DateScanned"] = p.datescanned;
                    dr["ExpiryDate"]  = p.expdat;
                    dr["Category"]    = p.FroChill;

                    clDtGriData.Rows.Add(dr);
                    clDtGriData.AcceptChanges();

                    dataGridView.DataSource = clDtGriData;
                }
                else
                {
                    MessageBox.Show("The client for this item does not match. Please scan an item with matching clients");
                }
            }
        }
Example #11
0
        public Pallet Update(Pallet palletChanges)
        {
            palletChanges.PalletNum  = palletChanges.PalletNum.ToUpperCase();
            palletChanges.PalletType = palletChanges.PalletType.ToUpperCase();

            var parameters = new List <ParameterInfo>
            {
                new ParameterInfo()
                {
                    ParameterName = nameof(Pallet.PalletId).Parameterize(), ParameterValue = palletChanges.PalletId
                },
                new ParameterInfo()
                {
                    ParameterName = nameof(Pallet.PalletNum).Parameterize(), ParameterValue = (palletChanges.PalletNum ?? String.Empty)
                },
                new ParameterInfo()
                {
                    ParameterName = nameof(Pallet.PalletType).Parameterize(), ParameterValue = (palletChanges.PalletType ?? String.Empty)
                },
                new ParameterInfo()
                {
                    ParameterName = nameof(Pallet.PalletTypeId).Parameterize(), ParameterValue = palletChanges.PalletTypeId
                },
                new ParameterInfo()
                {
                    ParameterName = nameof(Pallet.UpdatedWt).Parameterize(), ParameterValue = palletChanges.UpdatedWt
                },
                new ParameterInfo()
                {
                    ParameterName = nameof(Pallet.EstimatedWt).Parameterize(), ParameterValue = palletChanges.EstimatedWt
                }
            };

            StringBuilder qry = new StringBuilder();

            qry.AppendLine("Update Pallets set");
            qry.AppendLine($"{nameof(palletChanges.PalletNum)}={nameof(palletChanges.PalletNum).Parameterize()}" + (char)44);
            qry.AppendLine($"{nameof(palletChanges.PalletType)}={nameof(palletChanges.PalletType).Parameterize()}" + (char)44);
            qry.AppendLine($"{nameof(palletChanges.PalletTypeId)}={nameof(palletChanges.PalletTypeId).Parameterize()}" + (char)44);
            qry.AppendLine($"{nameof(palletChanges.UpdatedWt)}={nameof(palletChanges.UpdatedWt).Parameterize()}" + (char)44);
            qry.AppendLine($"{nameof(palletChanges.EstimatedWt)}={nameof(palletChanges.EstimatedWt).Parameterize()}");
            qry.AppendLine($"where {nameof(palletChanges.PalletId)} = {nameof(palletChanges.PalletId).Parameterize()}");
            DBContext.ExecuteQuery(qry.ToString(), parameters);
            return(palletChanges);
        }
Example #12
0
        public Pallet CreateNewPallet(string ssCode, int capacity)
        {
            Exception lastEx = new Exception("Unknown exception when creating new pallet.");

            for (int i = 0; i < 3; i++)
            {
                try
                {
                    int currDate = FormatHelper.GetNowDBDateTime(this.DataProvider).DBDate;

                    string   sql  = "SELECT NVL(MAX(palletcode), '0000') palletcode FROM tblpallet WHERE palletcode LIKE '" + ssCode + currDate.ToString() + "P____'";
                    object[] objs = this.DataProvider.CustomQuery(typeof(Pallet), new SQLCondition(sql));

                    if (objs != null)
                    {
                        string last = ((Pallet)objs[0]).PalletCode;
                        last = last.Substring(last.Length - 4);
                        string serialNo  = string.Format("{0:0000}", int.Parse(last) + 1);
                        Pallet newPallet = new Pallet();
                        newPallet.PalletCode     = ssCode + currDate.ToString() + "P" + serialNo.ToString();
                        newPallet.OrganizationID = GlobalVariables.CurrentOrganizations.First().OrganizationID;

                        newPallet.ItemCode     = " ";
                        newPallet.MOCode       = " ";
                        newPallet.SSCode       = " ";
                        newPallet.Capacity     = capacity;
                        newPallet.RCardCount   = 0;
                        newPallet.MaintainUser = "******";
                        newPallet.MaintainDate = 0;
                        newPallet.MaintainTime = 0;
                        newPallet.EAttribute1  = " ";

                        AddPallet(newPallet);

                        return(newPallet);
                    }
                }
                catch (Exception ex)
                {
                    lastEx = ex;
                }
            }

            throw lastEx;
        }
Example #13
0
        private void LoadPallet(string tilesetName)
        {
            if (!tilesetName.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
            {
                tilesetName += ".png";
            }

            if (_map != null)
            {
                _map.Pallet = Pallet.Get(tilesetName);
            }
            else
            {
                _map = new WorldMap(tilesetName);
            }

            picturePallet.Image = _map.Pallet.Image;
        }
    public Pallet GetPalletInfo(string palletno)
    {
        Pallet pallet = null;

        try
        {
            using (ProductCardRePackBLL prodRePack = new ProductCardRePackBLL())
            {
                pallet = prodRePack.GetPalletDetail(palletno);
            }
        }
        catch (Exception ex)
        {
            pallet = null;
            throw ex;
        }
        return(pallet);
    }
Example #15
0
        public static Pallet SaveOrUpdate(Pallet pallet)
        {
            try
            {
                if (pallet.Code == 0)
                {
                    new Exception("El código de estación no puede ser 0");
                }

                PalletRepository.SaveOrUpdate(pallet);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(pallet);
        }
Example #16
0
        public void Manufacture(Dossier dossier)
        {
            Pallet pallet = new Pallet();

            CodeWriter cw = new CodeWriter();

            cw.WriteLine($@"import * as enumerations from  ""../Models/Enumerations""");
            cw.WriteLine($@"import * as models from  ""../Models/Models""");

            foreach (ServiceInfo info in dossier.Info.Services)
            {
                TssServiceMold mold = Services.Create(info);
                mold.CreateInterfaces(cw, dossier, info);
            }

            pallet.AddProduct("TssServiceInterface", "Services", $@"Interfaces.ts", cw);

            dossier.Pallets.Add(pallet);
        }
        /// <summary>
        /// Validation done for palletizing an orphan carton.
        /// DB: Think if we can avoid some of these these validations??
        /// Shouldn't we allow a carton to be placed on a pallet even if it is from other area?
        /// </summary>
        /// <param name="cartonId"></param>
        /// <param name="pallet"></param>
        /// <returns></returns>
        public Pallet PalletizeCarton(string cartonId, Pallet pallet)
        {
            if (pallet.SkuCount > 1)
            {
                throw new ProviderException(string.Format("Pallet {0} contains {1} different SKUs, Can't Palletize carton {2}", pallet.PalletId, pallet.SkuCount, cartonId));
            }
            if (pallet.AreaCount > 1)
            {
                throw new ProviderException(string.Format("Pallet {0} contains cartons of {1} different Areas, Can't Palletize carton {2}", pallet.PalletId, pallet.AreaCount, cartonId));
            }
            if (pallet.CartonVwhCount > 1)
            {
                throw new ProviderException(string.Format("Pallet {0} contains cartons of {1} different VWh, Can't Palletize carton {2}", pallet.PalletId, pallet.CartonVwhCount, cartonId));
            }
            if (pallet.CartonQualityCount > 1)
            {
                throw new ProviderException(string.Format("Pallet {0} contains cartons of {1} different Qualities, Can't Palletize carton {2}", pallet.PalletId, pallet.CartonQualityCount, cartonId));
            }
            var carton = GetCarton(cartonId);

            if (carton == null || carton.Sku == null)
            {
                throw new ProviderException(string.Format("Invalid carton {0} passed.", cartonId));
            }
            if (pallet.PalletSku != null && pallet.PalletSku.SkuId != carton.Sku.SkuId)
            {
                throw new ProviderException(string.Format("Pallet {0} contains SKU {1} but carton having SKU {2}, Can't Palletize carton {3}", pallet.PalletId, pallet.PalletSku, carton.Sku, carton.CartonId));
            }
            if (pallet.CartonVwhId != carton.VwhId)
            {
                throw new ProviderException(string.Format("Pallet {0} contains SKU of VWh {1} but carton having SKU of VWh {2}, Can't Palletize carton {3}", pallet.PalletId, pallet.CartonVwhId, carton.VwhId, carton.CartonId));
            }
            if (pallet.PalletArea.AreaId != carton.Area.AreaId)
            {
                throw new ProviderException(string.Format("Cartons on the pallet {0} belongs to area {1} but carton {2} belong to area {3}, Can't Palletize carton", pallet.PalletId, pallet.PalletArea.ShortName, carton.CartonId, carton.Area.ShortName));
            }
            if (pallet.CartonQuality != carton.QualityCode)
            {
                throw new ProviderException(string.Format("Cartons on the pallet {0} having quality {1} but carton {2} having qality {3}, Can't Palletize carton", pallet.PalletId, pallet.CartonQuality, carton.CartonId, carton.QualityCode));
            }
            _repos.PalletizeCarton(pallet.PalletId, cartonId);
            return(_repos.GetPallet(pallet.PalletId, null));
        }
    public Pallet GetUpdatePalletLoading(string loadNo, string palletno, string userid, out string resultMsg) //, out string resultMsg
    {
        resultMsg = string.Empty;
        Pallet pallet = null;

        try
        {
            using (ProductCardLOADBLL prdLoadingBll = new ProductCardLOADBLL())
            {
                pallet = prdLoadingBll.GetUpdatePalletLoading(loadNo, palletno, userid, out resultMsg);
            }
        }
        catch (Exception ex)
        {
            pallet = null;
            throw ex;
        }
        return(pallet);
    }
Example #19
0
        public bool Update(int PalletId, string PalletName, int YardLocationId)
        {
            bool isSaved = true;

            try
            {
                pl                = db.Pallet.Find(PalletId);
                pl.PalletName     = PalletName;;
                pl.YardLocationId = YardLocationId;

                db.Pallet.AddOrUpdate(pl);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                isSaved = false;
            }
            return(isSaved);
        }
 public void StartArrivalStation()
 {
     while (true)
     {
         List <Good> goods = GeneratorClient.GenerateRandomNumberOfGoods();
         foreach (Good g in goods)
         {
             Pallet pallet = new Pallet()
             {
                 count = rnd.Next(10, 200),
                 good  = g,
             };
             Console.WriteLine($"Pallet | Count:{pallet.count} | Good name: {pallet.good.name} | Good manufacturer: {pallet.good.manufacturer} |");
             client.insertPallet(pallet);
             Thread.Sleep(rnd.Next(3000, 5000));
             Console.WriteLine("Pallet inserted!");
         }
     }
 }
 public void AddToPallets(Pallet pallet)
 {
     base.AddObject("Pallets", pallet);
 }
        public ReceiveDoc CreateInventoryReceive(Inventory inventory,int receiptID,Inventory.QuantityType quantityType,DateTime ethiopianDate,User user)
        {
            ItemUnit itemUnit = new ItemUnit();
            itemUnit.LoadByPrimaryKey(inventory.UnitID);

            ReceiveDoc receiveDoc = new ReceiveDoc();
            receiveDoc.AddNew();
            receiveDoc.ItemID = inventory.ItemID;
            receiveDoc.UnitID = inventory.UnitID;
            receiveDoc.ManufacturerId = inventory.ManufacturerID;

            receiveDoc.StoreID = inventory.ActivityID;
            receiveDoc.Date = ethiopianDate;
            receiveDoc.EurDate = DateTimeHelper.ServerDateTime;
            receiveDoc.PhysicalStoreID = inventory.PhysicalStoreID;
            receiveDoc.SetColumn("BatchNo", inventory.GetColumn("BatchNo"));
            decimal quantity = quantityType == Inventory.QuantityType.Sound
                                   ? inventory.InventorySoundQuantity
                                   : quantityType == Inventory.QuantityType.Damaged
                                    ? inventory.InventoryDamagedQuantity :inventory.InventoryExpiredQuantity;

            if(quantityType == Inventory.QuantityType.Damaged) receiveDoc.ShortageReasonID = ShortageReasons.Constants.DAMAGED;
            receiveDoc.Quantity = receiveDoc.QuantityLeft = quantity * itemUnit.QtyPerUnit;
            receiveDoc.NoOfPack = receiveDoc.InvoicedNoOfPack = quantity;
            receiveDoc.QtyPerPack = itemUnit.QtyPerUnit;
            receiveDoc.SetColumn("ExpDate", inventory.GetColumn("ExpiryDate"));

            receiveDoc.Out = false;

            receiveDoc.ReceivedBy = user.UserName;

            receiveDoc.StoreID = inventory.ActivityID;
            receiveDoc.RefNo = "BeginningBalance";
            decimal cost = 0;
            decimal margin = 0;

            if (!inventory.IsColumnNull("Cost"))
            {
                cost = inventory.Cost;
            }

            if(!inventory.IsColumnNull("Margin"))
            {
                margin = inventory.Margin;
            }

            receiveDoc.Cost = Convert.ToDouble(cost);
            receiveDoc.PricePerPack = Convert.ToDouble(cost);
            receiveDoc.UnitCost = cost;
            receiveDoc.Margin = Convert.ToDouble(margin);
            receiveDoc.SellingPrice = Convert.ToDouble(BLL.Settings.IsCenter ? cost : cost * (1 + margin));
            receiveDoc.SupplierID = 2; //TODO: HARDCODE WARNING WARNING WARNING
            receiveDoc.DeliveryNote = false;
            receiveDoc.Confirmed = true;
            receiveDoc.ConfirmedDateTime = DateTimeHelper.ServerDateTime;
            receiveDoc.ReturnedStock = false;
            receiveDoc.ReceiptID = receiptID;
            receiveDoc.RefNo = "BeginningBalance";
            receiveDoc.InventoryPeriodID = inventory.InventoryPeriodID;
            receiveDoc.IsDamaged = (quantityType == Inventory.QuantityType.Damaged ||
                                   quantityType == Inventory.QuantityType.Expired);
            receiveDoc.Save();

            //Now Save the ReceiveDocConfirmation

            ReceiveDocConfirmation rdConf = new ReceiveDocConfirmation();
            rdConf.AddNew();
            rdConf.ReceiveDocID = receiveDoc.ID;
            rdConf.ReceivedByUserID = user.ID;
            rdConf.ReceiptConfirmationStatusID = ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED;
            rdConf.Save();

            //TODO: Create Receive Pallet Here
            PalletLocation palletLocation = new PalletLocation();

            palletLocation.LoadByPrimaryKey(quantityType != Inventory.QuantityType.Damaged
                                                ? inventory.PalletLocationID
                                                : inventory.DamagedPalletLocationID);

            ReceivePallet receivePallet = new ReceivePallet();
            receivePallet.AddNew();
            receivePallet.Balance = quantity * itemUnit.QtyPerUnit;
            receivePallet.ReceivedQuantity = quantity * itemUnit.QtyPerUnit;
            receivePallet.ReservedStock = 0;
            receivePallet.ReceiveID = receiveDoc.ID;

            if(palletLocation.IsColumnNull("PalletID"))
            {
                Pallet pallet = new Pallet();
                pallet.AddNew();
                pallet.Save();
                palletLocation.PalletID = pallet.ID;
                palletLocation.Save();
            }

            receivePallet.PalletID = palletLocation.PalletID;
            receivePallet.PalletLocationID =palletLocation.ID;
            receivePallet.BoxSize = 0;
            receivePallet.IsOriginalReceive = true;
            receivePallet.Save();

            return receiveDoc;
        }
 /// <summary>
 /// Create a new Pallet object.
 /// </summary>
 /// <param name="id">Initial value of Id.</param>
 /// <param name="lote">Initial value of Lote.</param>
 /// <param name="bloqueado">Initial value of Bloqueado.</param>
 public static Pallet CreatePallet(long id, string lote, string bloqueado)
 {
     Pallet pallet = new Pallet();
     pallet.Id = id;
     pallet.Lote = lote;
     pallet.Bloqueado = bloqueado;
     return pallet;
 }
 public JobException(Job j, Pallet p, String s) : this(j, s)
 {
     Pallet = p;
 }
 public PalletException(Pallet n, String s): this(n.ToString() + s)
 {
 }
Example #26
0
 private void LoadPallet(string tilesetName)
 {
     _pallet = Pallet.Get(tilesetName);
     picturePallet.Image = _pallet.Image;
 }