Example #1
0
        /// <summary>
        /// save packing list
        /// </summary>
        /// <param name="newPackingList"></param>
        /// <returns></returns>
        public OperationResult SavePackingList(PackingList newPackingList)
        {
            var operationResult = new OperationResult();

            try
            {
                var existingPackingList = _db.PackingList.FirstOrDefault(x => x.PackingListId == newPackingList.PackingListId);

                if (existingPackingList == null)
                {
                    logger.Debug("PackingList is being created...");

                    var insertedPackingList = _db.PackingList.Add(newPackingList);

                    _db.SaveChanges();

                    operationResult.Success     = true;
                    operationResult.Message     = "Success";
                    operationResult.ReferenceId = insertedPackingList.PackingListId;
                }
                else
                {
                    operationResult.Success = false;
                    operationResult.Message = "Duplicate Entry";
                }
            }
            catch (Exception ex)
            {
                operationResult.Success = false;
                operationResult.Message = "Error";
                logger.ErrorFormat("Error saving new packing list: {0} ", ex.ToString());
            }

            return(operationResult);
        }
Example #2
0
        /// <summary>
        /// convert packlingList view model to domain
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public PackingList ConvertToDomain(PackingListViewModel model)
        {
            PackingList packingList = new PackingList();

            packingList.PackingListId     = model.PackingListId;
            packingList.CustomerId        = model.CustomerId;
            packingList.CustomerAddressId = model.CustomerAddressId;
            packingList.ShipDate          = model.ShipDate;
            packingList.Freight           = model.Freight;
            packingList.CarrierId         = model.CarrierId;
            packingList.NetWeight         = model.NetWeight;
            packingList.GrossWeight       = model.GrossWeight;
            packingList.TrailerNumber     = model.TrailerNumber;
            packingList.TrackingNumber    = model.TrackingNumber;
            packingList.Notes             = model.Notes;
            packingList.DeliveryDate      = model.DeliveryDate;
            packingList.IsClosed          = model.IsClosed;
            packingList.ClosedDate        = (model.IsClosed) ? DateTime.Now : model.ClosedDate;

            if (model.PackingListParts != null && model.PackingListParts.Count() > 0)
            {
                var packingListParts = new List <PackingListPart>();

                foreach (var part in model.PackingListParts)
                {
                    PackingListPart packingListPart = new PackingListPartConverter().ConvertToDomain(part);

                    packingListParts.Add(packingListPart);
                }

                packingList.PackingListParts = packingListParts;
            }

            return(packingList);
        }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            PackingList packingList = db.PackingLists.Find(id);

            db.PackingLists.Remove(packingList);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
        // POST api/dummypackinglist
        public PackingList Post(string foliollegadaid, string proyectoid, string username, string token)
        {
            PackingList packinglist = new PackingList();

            packinglist.PackingListID = "123789456";

            return(packinglist);
        }
Example #5
0
        /// <summary>
        /// convert packlingList to list model
        /// </summary>
        /// <param name="packingList"></param>
        /// <returns></returns>
        public PackingListViewModel ConvertToListView(PackingList packingList)
        {
            PackingListViewModel model = new PackingListViewModel();

            var _customerDynamicsRepository        = new CustomerDynamicsRepository();
            var _customerAddressDynamicsRepository = new CustomerAddressDynamicsRepository();
            var _stateRepository   = new StateRepository();
            var _carrierRepository = new CarrierRepository();

            var dynamicsCustomer        = _customerDynamicsRepository.GetCustomer(packingList.CustomerId);
            var dynamicsCustomerAddress = _customerAddressDynamicsRepository.GetCustomerAddress(packingList.CustomerAddressId);
            var state     = _stateRepository.GetState((dynamicsCustomerAddress != null && !string.IsNullOrEmpty(dynamicsCustomerAddress.STATE)) ? dynamicsCustomerAddress.STATE : string.Empty);
            var stateName = (state != null && !string.IsNullOrEmpty(state.Name)) ? ", " + state.Name : string.Empty;
            var carrier   = _carrierRepository.GetCarrier(packingList.CarrierId);

            model.PackingListId   = packingList.PackingListId;
            model.CreatedDate     = (packingList.CreatedDate != null) ? packingList.CreatedDate : DateTime.MinValue;
            model.CreatedDateStr  = (packingList.CreatedDate != null) ? packingList.CreatedDate.Value.ToShortDateString() : "N/A";
            model.CustomerName    = (dynamicsCustomer != null && !string.IsNullOrEmpty(dynamicsCustomer.SHRTNAME)) ? dynamicsCustomer.SHRTNAME : "N/A";
            model.CustomerAddress = (dynamicsCustomerAddress != null) ? dynamicsCustomerAddress.ADDRESS1 + " " +
                                    dynamicsCustomerAddress.CITY + ", " + stateName : "N/A";
            model.ShipDate       = packingList.ShipDate;
            model.ShipDateStr    = packingList.ShipDate.ToShortDateString();
            model.CarrierName    = (carrier != null && !string.IsNullOrEmpty(carrier.Name)) ? carrier.Name : "N/A";
            model.TrackingNumber = (!string.IsNullOrEmpty(packingList.TrackingNumber)) ? packingList.TrackingNumber : "N/A";
            model.Notes          = (!string.IsNullOrEmpty(packingList.TrackingNumber)) ? packingList.Notes : "N/A";
            model.IsClosed       = packingList.IsClosed;
            model.ClosedDate     = (packingList.ClosedDate != null) ? packingList.ClosedDate : DateTime.MinValue;
            model.ClosedDateStr  = (packingList.ClosedDate != null) ? packingList.ClosedDate.Value.ToShortDateString() : "N/A";

            if (_customerDynamicsRepository != null)
            {
                _customerDynamicsRepository.Dispose();
                _customerDynamicsRepository = null;
            }

            if (_customerAddressDynamicsRepository != null)
            {
                _customerAddressDynamicsRepository.Dispose();
                _customerAddressDynamicsRepository = null;
            }

            if (_stateRepository != null)
            {
                _stateRepository.Dispose();
                _stateRepository = null;
            }

            if (_carrierRepository != null)
            {
                _carrierRepository.Dispose();
                _carrierRepository = null;
            }

            return(model);
        }
Example #6
0
 public ActionResult Edit([Bind(Include = "Id,S_No,Item,Roll_No,Colour,Gsm,Width,Output,NetWt,Remarks")] PackingList packingList)
 {
     if (ModelState.IsValid)
     {
         db.Entry(packingList).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(packingList));
 }
Example #7
0
 public Journey(string name, string date, string picturePath, PackingList packingList, Budget budget, List <Airplane> airplane, List <Train> train, List <Bus> bus)
 {
     this.Name        = name;
     this.Date        = date;
     this.PicturePath = picturePath;
     this.PackingList = packingList;
     this.Budget      = budget;
     this.Airplane    = airplane;
     this.Bus         = bus;
     this.Train       = train;
 }
Example #8
0
        public ActionResult Create([Bind(Include = "Id,S_No,Item,Roll_No,Colour,Gsm,Width,Output,NetWt,Remarks")] PackingList packingList)
        {
            if (ModelState.IsValid)
            {
                db.PackingLists.Add(packingList);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(packingList));
        }
        public void CopyDocument(PackingList doc)
        {
            if (doc == null)
                return;

            var copy = doc.Copy();
            copy.OrderId = null;
            copy.Id = null;
            copy.Positions.Clear();

            _dataManagersFactory.GetDataManager<PackingList>().Insert(copy);
        }
Example #10
0
        public override void Initialize()
        {
            base.Initialize();
            PackingList.SetVisible(false);

            var curCoutry = (PXSelect <Branch> .Select(Base, PX.Data.Update.PXInstanceHelper.CurrentCompany)).TopFirst;

            if (curCoutry?.CountryID == "TW" || curCoutry?.BaseCuryID == "TWD")
            {
                PackingList.SetVisible(true);
                Base.report.AddMenuAction(PackingList);
            }
        }
Example #11
0
        // GET: PackingLists/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PackingList packingList = db.PackingLists.Find(id);

            if (packingList == null)
            {
                return(HttpNotFound());
            }
            return(View(packingList));
        }
Example #12
0
        // GET api/dummypackinglist
        public IEnumerable <PackingList> Get()
        {
            List <PackingList> lstPackingList = new List <PackingList>();
            PackingList        packinglist    = new PackingList();
            PackingList        packinglist1   = new PackingList();

            packinglist.PackingListID = "1";
            packinglist.Consecutivo   = "2";
            lstPackingList.Add(packinglist);

            packinglist1.PackingListID = "2";
            packinglist1.Consecutivo   = "3";
            lstPackingList.Add(packinglist1);
            return(lstPackingList);
        }
Example #13
0
        /// <summary>
        /// get packing list by id
        /// </summary>
        /// <param name="packingListId"></param>
        /// <returns></returns>
        public PackingList GetPackingList(Guid packingListId)
        {
            var packingList = new PackingList();

            try
            {
                packingList = _db.PackingList.FirstOrDefault(x => x.PackingListId == packingListId);
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Error getting packing list: {0} ", ex.ToString());
            }

            return(packingList);
        }
        public PackingListBO Convert(PackingList packingList)
        {
            if (packingList == null)
            {
                return(null);
            }
            return(new PackingListBO()
            {
                Id = packingList.Id,
                PackingName = packingList.PackingName,
                CreatorName = packingList.CreatorName,
                DeliveryAddress = packingList.DeliveryAddress,
                DeliveryDate = packingList.DeliveryDate,
                ItemType = packingList.ItemType,
                FreightType = packingList.FreightType,
                IsActive = packingList.IsActive,

                ProjectIds = packingList.Projects?.Select(p => p.ProjectID).ToList(),
                ColliListIds = packingList.ColliLists?.Select(cl => cl.ColliListID).ToList(),
                PackItemsIds = packingList.PackItems?.Select(pi => pi.Id).ToList()
            });
        }
        private void BrowseManifestCommandAction()
        {
            var view = new Contents.ManifestOutgoing.BrowseSTT();

            var dlg = new ModernWindow()
            {
                Title       = "Simulasi Manifest Outgoing",
                Style       = (Style)App.Current.Resources["BlankWindow"],
                ResizeMode  = System.Windows.ResizeMode.CanResizeWithGrip,
                WindowState = WindowState.Maximized,
                Content     = view,
            };

            if (this.PackingListSimulation == null)
            {
                this.PackingListSimulation = new Models.PackingListSimulation(this.SourceFromDatabase);
            }


            var vm = new Contents.ManifestOutgoing.BrowseSTTVM(PackingListSimulation)
            {
                CloseWindow = dlg.Close
            };

            view.DataContext = vm;
            dlg.ShowDialog();

            if (PackingListSimulation.Packs.Count > 0)
            {
                this.PackingList = new List <packinglist>();
                PenjualanTemporaty.Clear();
                foreach (var item in SourceFromDatabase.Where(O => O.IsSelected == true))
                {
                    var a = new PenjualanView {
                        Reciver = item.Reciver, Shiper = item.Shiper, STT = item.STT
                    };
                    foreach (var pack in PackingListSimulation.Packs)
                    {
                        foreach (var cly in pack.PackingLists)
                        {
                            if (item.STT == cly.STT)
                            {
                                PackingList.Add(new packinglist {
                                    PenjualanId = item.Id, CollyId = cly.Id, CollyNumber = cly.CollyNumber, PackNumber = pack.PackNumber, STT = item.STT, Weight = cly.Weight
                                });
                                a.Details.Add(cly);
                                a.Pcs++;
                                a.Weight += cly.Weight;
                            }
                        }
                    }
                    if (a.Pcs > 0)
                    {
                        PenjualanTemporaty.Add(a);
                    }
                }
                this.PenjualanTemporaryView.Refresh();
            }
            else
            {
                this.PackingListSimulation = null;
            }
        }
Example #16
0
        public void CreatePackingList(Order order, PackingList packingList)
        {
            _pck = new ExcelPackage();
            var ws = _pck.Workbook.Worksheets.Add("Упаковочный лист");
            ws.PrinterSettings.Orientation = eOrientation.Portrait;
            ws.PrinterSettings.PaperSize = ePaperSize.A4;
            ws.PrinterSettings.FitToPage = true;
            ws.PrinterSettings.FitToWidth = 1;

            ws.Column(1).Width = 26;
            ws.Column(2).Width = 26;
            ws.Column(3).Width = 8;
            ws.Column(4).Width = 8;
            ws.Column(5).Width = 12;
            ws.Column(6).Width = 11;
            ws.Column(7).Width = 11;
            ws.Column(8).Width = 7;
            ws.Column(9).Width = 7;
            ws.Column(10).Width = 7;

            ws.Cells.Style.Font.Size = 10;

            ws.Cells[3, 1].Value = "Поставщик:";
            ws.Cells[3, 1].Style.Font.Bold = true;
            ws.Cells[4, 1].Value = order.Provider;
            ws.Cells[5, 1].Value = order.Address;

            ws.Cells[7, 1].Value = "Грузополучатель:";
            ws.Cells[7, 1].Style.Font.Bold = true;
            ws.Cells[8, 1].Value = order.Client;
            ws.Cells[9, 1].Value = order.ClientAddress;

            ws.Cells[3, 6, 3, 8].Merge = true;
            ws.Cells[3, 6, 3, 8].Value = "УПАКОВОЧНЫЙ ЛИСТ №";
            ws.Cells[3, 6, 3, 8].Style.Font.UnderLine = true;
            ws.Cells[3, 6, 3, 8].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;

            ws.Cells[3, 9, 3, 10].Merge = true;
            ws.Cells[3, 9, 3, 10].Value = packingList.Number;
            ws.Cells[3, 9, 3, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[3, 9, 3, 10].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            
            ws.Cells[3, 6, 3, 11].Style.Font.Bold = true;

            ws.Cells[11, 1, 12, 2].Style.WrapText = true;
            ws.Cells[11, 1, 12, 2].Merge = true;
            ws.Cells[11, 1].Value = order.Contract;
            ws.Cells[11, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[11, 1].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[11, 1].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells[11, 1].Style.Fill.BackgroundColor.SetColor(Color.LightGray);

            ws.Cells[11, 1, 12, 2].Style.Border.BorderAround(ExcelBorderStyle.Thick);

            ws.Cells[13, 7].Value = "Лист";
            ws.Cells[13, 8].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[13, 9].Value = "Листов";
            ws.Cells[13, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[14, 1].Value = "Маркировка";
            ws.Cells[14, 2].Value = "Наименование";
            ws.Cells[14, 3].Value = "Кол-во, шт.";
            ws.Cells[14, 4].Value = "Номер товарного места";
            ws.Cells[14, 5].Value = "Вид груз. места";
            ws.Cells[14, 6].Value = "Вес Брутто, кг";
            ws.Cells[14, 7].Value = "Вес Нетто, кг";
            ws.Cells[14, 8, 14, 10].Merge = true;
            ws.Cells[14, 8, 14, 10].Value = "Габариты, см.\nдлина ширина высота";

            ws.Cells[14, 1, 14, 10].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[14, 1, 14, 10].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[14, 1, 14, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[14, 1, 14, 10].Style.WrapText = true;

            ws.Row(14).CustomHeight = false;

            var countPos = packingList.Positions.Count;

            for (int i = 0; i < countPos; i++)
            {
                ws.Cells[15 + i, 1].Value = packingList.Positions[i].Designation;
                ws.Cells[15 + i, 2].Value = packingList.Positions[i].Name;
                ws.Cells[15 + i, 3].Value = packingList.Positions[i].Count;
            }

            ws.Cells[15, 4, 15 + countPos - 1, 4].Merge = true;
            ws.Cells[15, 4, 15 + countPos - 1, 4].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[15, 4, 15 + countPos - 1, 4].Style.VerticalAlignment = ExcelVerticalAlignment.Center;

            ws.Cells[15, 5, 15 + countPos - 1, 5].Merge = true;
            ws.Cells[15, 5, 15 + countPos - 1, 5].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[15, 5, 15 + countPos - 1, 5].Style.VerticalAlignment = ExcelVerticalAlignment.Center;

            ws.Cells[15, 6, 15 + countPos - 1, 6].Merge = true;
            ws.Cells[15, 6, 15 + countPos - 1, 6].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[15, 6, 15 + countPos - 1, 6].Style.VerticalAlignment = ExcelVerticalAlignment.Center;

            ws.Cells[15, 7, 15 + countPos - 1, 7].Merge = true;
            ws.Cells[15, 7, 15 + countPos - 1, 7].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[15, 7, 15 + countPos - 1, 7].Style.VerticalAlignment = ExcelVerticalAlignment.Center;

            ws.Cells[15, 8, 15 + countPos - 1, 8].Merge = true;
            ws.Cells[15, 8, 15 + countPos - 1, 8].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[15, 8, 15 + countPos - 1, 8].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[15, 8, 15 + countPos - 1, 8].Value = packingList.PlaceLength;

            ws.Cells[15, 9, 15 + countPos - 1, 9].Merge = true;
            ws.Cells[15, 9, 15 + countPos - 1, 9].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[15, 9, 15 + countPos - 1, 9].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[15, 9, 15 + countPos - 1, 9].Value = packingList.PlaceWidth;

            ws.Cells[15, 10, 15 + countPos - 1, 10].Merge = true;
            ws.Cells[15, 10, 15 + countPos - 1, 10].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[15, 10, 15 + countPos - 1, 10].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[15, 10, 15 + countPos - 1, 10].Value = packingList.PlaceHeight;

            ws.Cells[15, 7].Value = packingList.Positions.Sum(x => x.WeigthSend);
            ws.Cells[15, 7].Style.Numberformat.Format = "0.00";

            ws.Cells[14, 1, 14 + countPos, 10].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
            ws.Cells[14, 1, 14 + countPos, 10].Style.Border.Top.Style = ExcelBorderStyle.Thin;
            ws.Cells[14, 1, 14 + countPos, 10].Style.Border.Left.Style = ExcelBorderStyle.Thin;
            ws.Cells[14, 1, 14 + countPos, 10].Style.Border.Right.Style = ExcelBorderStyle.Thin;

            ws.Cells[15 + countPos, 5].Value = @"ИТОГО:";
            ws.Cells[15 + countPos, 5, 15 + countPos, 7].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
            ws.Cells[15 + countPos, 5, 15 + countPos, 7].Style.Border.Top.Style = ExcelBorderStyle.Thin;
            ws.Cells[15 + countPos, 5, 15 + countPos, 7].Style.Border.Left.Style = ExcelBorderStyle.Thin;
            ws.Cells[15 + countPos, 5, 15 + countPos, 7].Style.Border.Right.Style = ExcelBorderStyle.Thin;

            ws.Cells[15 + countPos, 5].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;

            ws.Cells[15 + countPos, 6].Formula = @"=" + ws.Cells[15, 6].Address;
            ws.Cells[15 + countPos, 6].Style.Numberformat.Format = "0.00";

            ws.Cells[15 + countPos, 7].Formula = @"=" + ws.Cells[15, 7].Address;
            ws.Cells[15 + countPos, 7].Style.Numberformat.Format = "0.00";

            ws.Cells[15 + countPos, 8].Value = @" V= ";
            ws.Cells[15 + countPos, 8, 15 + countPos, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[15 + countPos, 9, 15 + countPos, 10].Merge = true;
            ws.Cells[15 + countPos, 9, 15 + countPos, 10].Formula = "=" + ws.Cells[15, 8].Address + "*" + ws.Cells[15, 9].Address + "*" + ws.Cells[15, 10].Address + "/1000000";
            ws.Cells[15 + countPos, 9, 15 + countPos, 10].Style.Numberformat.Format = "0.000";
            ws.Cells[15 + countPos, 1, 15 + countPos, 10].Style.Font.Bold = true;
            ws.Cells[15 + countPos, 1, 15 + countPos, 10].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;

            ws.Cells[15 + countPos + 1, 1, 15 + countPos + 1, 10].Merge = true;
            ws.Cells[15 + countPos + 1, 1, 15 + countPos + 1, 10].Value = @"Указанный в настоящем документе товар соответствует по качеству действующим в Российской Федерации стандартам и техническим условиям.";
            ws.Cells[15 + countPos + 1, 1, 15 + countPos + 1, 10].Style.Font.Size = 9;

            var startTable = 15 + countPos + 3;

            ws.Cells[startTable, 1].Value = "Грузополучатель:";
            ws.Cells[startTable, 1].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable, 2, startTable, 10].Merge = true;
            ws.Cells[startTable, 2, startTable, 10].Formula = "=" + ws.Cells[8, 1].Address;
            ws.Cells[startTable, 2, startTable, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 1, 1].Value = "Пункт назначения:";
            ws.Cells[startTable + 1, 1].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 1, 2, startTable + 1, 10].Merge = true;
            ws.Cells[startTable + 1, 2, startTable + 1, 10].Formula = "=" + ws.Cells[9, 1].Address;
            ws.Cells[startTable + 1, 2, startTable + 1, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 2, 1].Value = "Поставщик:";
            ws.Cells[startTable + 2, 1].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 2, 2, startTable + 2, 10].Merge = true;
            ws.Cells[startTable + 2, 2, startTable + 2, 10].Formula = "=" + ws.Cells[4, 1].Address;
            ws.Cells[startTable + 2, 2, startTable + 2, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 3, 1].Value = "Адрес:";
            ws.Cells[startTable + 3, 1].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 3, 2, startTable + 3, 10].Merge = true;
            ws.Cells[startTable + 3, 2, startTable + 3, 10].Formula = "=" + ws.Cells[5, 1].Address;
            ws.Cells[startTable + 3, 2, startTable + 3, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 4, 1].Value = "Грузоотправитель:";
            ws.Cells[startTable + 4, 1].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 4, 2, startTable + 4, 10].Merge = true;
            ws.Cells[startTable + 4, 2, startTable + 4, 10].Formula = "=" + ws.Cells[4, 1].Address;
            ws.Cells[startTable + 4, 2, startTable + 4, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 5, 1].Value = "Вес, кг:";
            ws.Cells[startTable + 5, 1].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 5, 2].Value = "Брутто";
            ws.Cells[startTable + 5, 2].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 5, 3].Formula = ws.Cells[15 + countPos, 6].Address;
            ws.Cells[startTable + 5, 3].Style.Numberformat.Format = "0.00";
            ws.Cells[startTable + 5, 3].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 5, 4].Value = "Нетто";
            ws.Cells[startTable + 5, 4].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 5, 5].Formula = ws.Cells[15 + countPos, 7].Address;
            ws.Cells[startTable + 5, 5].Style.Numberformat.Format = "0.00";
            ws.Cells[startTable + 5, 5].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 5, 7, startTable + 5, 10].Merge = true;
            ws.Cells[startTable + 5, 7, startTable + 5, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 6, 1].Value = "Габаритные размеры";
            ws.Cells[startTable + 6, 1].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 6, 2, startTable + 6, 10].Merge = true;
            ws.Cells[startTable + 6, 2, startTable + 6, 10].Formula = "=" + ws.Cells[15, 8].Address + "&\" x \"&" + ws.Cells[15, 9].Address + "&\" x \"&" + ws.Cells[15, 10];

            ws.Cells[startTable + 6, 2, startTable + 6, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 7, 1].Value = "Место №";
            ws.Cells[startTable + 7, 1].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 7, 2, startTable + 7, 10].Merge = true;
            ws.Cells[startTable + 7, 2, startTable + 7, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 7, 2, startTable + 7, 10].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
            ws.Cells[startTable + 7, 2, startTable + 7, 10].Formula = "=" + ws.Cells[3, 9].Address;

            ws.Cells[startTable, 1, startTable + 7, 1].Style.Font.Bold = true;

            startTable = startTable + 9;

            ws.Cells[startTable, 5].Value = "Подписи:";
            ws.Cells[startTable + 1, 5, startTable + 1, 6].Merge = true;
            ws.Cells[startTable + 1, 5].Value = "Директор по качеству:";

            ws.Cells[startTable + 1, 8, startTable + 1, 10].Merge = true;
            ws.Cells[startTable + 1, 8].Value = packingList.FioOtk;

            ws.Cells[startTable + 3, 5, startTable + 3, 6].Merge = true;
            ws.Cells[startTable + 3, 5].Value = "Мастер:";
            ws.Cells[startTable + 3, 8, startTable + 3, 10].Merge = true;
            ws.Cells[startTable + 3, 8].Value = packingList.FioMaster;

            ws.Cells[startTable + 5, 5, startTable + 5, 6].Merge = true;
            ws.Cells[startTable + 5, 5].Value = "Менеджер по продажам:";
            ws.Cells[startTable + 5, 8, startTable + 5, 10].Merge = true;
            ws.Cells[startTable + 5, 8].Value = packingList.FioManager;

            ws.Cells[startTable + 1, 5, startTable + 5, 5].Style.Font.Bold = true;

            ws.Cells[startTable + 7, 5, startTable + 7, 7].Merge = true;
            ws.Cells[startTable + 7, 5].Value = "\"_____\" ___________ " + DateTime.Now.Year + "г.";

            ws.DeleteRow(1);
            ws.DeleteRow(1);
        }
Example #17
0
        public void CreatePackingListPMZ(Order order, PackingList packingList)
        {
            _pck = new ExcelPackage();
            var ws = _pck.Workbook.Worksheets.Add("Упаковочный лист");

            ws.Column(1).Width = 8;
            ws.Column(2).Width = 26;
            ws.Column(3).Width = 8;
            ws.Column(4).Width = 8;
            ws.Column(5).Width = 12;
            ws.Column(6).Width = 11;
            ws.Column(7).Width = 11;
            ws.Column(8).Width = 11;
            ws.Column(9).Width = 5;
            ws.Column(10).Width = 5;
            ws.Column(11).Width = 5;

            ws.Cells.Style.Font.Size = 10;

            ws.Cells[1, 1, 3, 4].Merge = true;
            ws.Cells[1, 1, 3, 4].Value = order.Contract;

            ws.Cells[2, 5, 2, 7].Merge = true;
            ws.Cells[2, 5, 2, 7].Value = "Комплектовочная ведомость №";
            ws.Cells[2, 5, 2, 7].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
            ws.Cells[2, 9, 2, 10].Merge = true;

            ws.Cells[4, 5, 4, 7].Merge = true;
            ws.Cells[4, 5, 4, 7].Value = "УПАКОВОЧНЫЙ ЛИСТ №";
            ws.Cells[4, 5, 4, 7].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
            ws.Cells[4, 9, 4, 10].Merge = true;
            ws.Cells[4, 9, 4, 10].Value = packingList.Number;

            ws.Cells[4, 1].Value = "Покупатель:";
            ws.Cells[5, 1].Value = order.Buyer;

            ws.Cells[6, 7].Value = "ППУ №";
            ws.Cells[6, 7].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[6, 9].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[8, 7].Value = "КУ №";
            ws.Cells[8, 7].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[8, 9].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[10, 1].Value = "Грузополучатель:";
            ws.Cells[11, 1].Value = order.Сonsignee;

            ws.Cells[14, 1].Value = "Адрес доставки:";
            ws.Cells[15, 1].Value = order.AddressDelivery;

            ws.Cells[19, 1].Value = "Поставщик:";
            ws.Cells[21, 1].Value = order.Provider;

            ws.Cells[22, 4, 22, 6].Merge = true;
            ws.Cells[22, 4, 22, 6].Value = "Товарно транспортная накладная №";
            ws.Cells[22, 4, 22, 6].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
            ws.Cells[22, 7].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[22, 8].Value = "от";
            ws.Cells[22, 8].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;

            ws.Cells[22, 9, 22, 10].Merge = true;
            ws.Cells[22, 9, 22, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[23, 7].Value = "Лист";
            ws.Cells[23, 8].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[23, 9].Value = "Листов";
            ws.Cells[23, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[24, 1].Value = "ППУ №";
            ws.Cells[24, 2].Value = "Наименование составных частей узла, агрегата и т.п.";
            ws.Cells[24, 3].Value = "Кол-во, шт.";
            ws.Cells[24, 4].Value = "Номера товарных мест";
            ws.Cells[24, 5].Value = "Вид груз. мест";
            ws.Cells[24, 6].Value = "Вес Брутто, кг";
            ws.Cells[24, 7].Value = "Вес Нетто, кг";
            ws.Cells[24, 8, 24, 10].Merge = true;
            ws.Cells[24, 8, 24, 10].Value = "Габариты, см.\nдлина ширина высота";

            ws.Cells[24, 1, 24, 10].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[24, 1, 24, 10].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[24, 1, 24, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[24, 1, 24, 10].Style.WrapText = true;

            ws.Row(24).CustomHeight = false;

            var countPos = packingList.Positions.Count;

            ws.Cells[25, 2].Value = order.Name;

            for (int i = 0; i < countPos; i++)
            {
                ws.Cells[25 + i + 1, 1].Value = "";
                ws.Cells[25 + i + 1, 2].Value = packingList.Positions[i].Name + " " + packingList.Positions[i].Designation;
                ws.Cells[25 + i + 1, 3].Value = packingList.Positions[i].Count;
                ws.Cells[25 + i + 1, 7].Value = packingList.Positions[i].WeightAll;
            }

            countPos++;
            ws.Cells[25, 1, 25 + countPos - 1, 1].Merge = true;

            ws.Cells[25, 4, 25 + countPos - 1, 4].Merge = true;
            ws.Cells[25, 4, 25 + countPos - 1, 4].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[25, 4, 25 + countPos - 1, 4].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[25, 5, 25 + countPos - 1, 5].Merge = true;
            ws.Cells[25, 5, 25 + countPos - 1, 5].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[25, 5, 25 + countPos - 1, 5].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[25, 6, 25 + countPos - 1, 6].Merge = true;
            ws.Cells[25, 6, 25 + countPos - 1, 6].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[25, 6, 25 + countPos - 1, 6].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[25, 8, 25 + countPos - 1, 8].Merge = true;
            ws.Cells[25, 8, 25 + countPos - 1, 8].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[25, 8, 25 + countPos - 1, 8].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[25, 9, 25 + countPos - 1, 9].Merge = true;
            ws.Cells[25, 9, 25 + countPos - 1, 9].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[25, 9, 25 + countPos - 1, 9].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
            ws.Cells[25, 10, 25 + countPos - 1, 10].Merge = true;
            ws.Cells[25, 10, 25 + countPos - 1, 10].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[25, 10, 25 + countPos - 1, 10].Style.VerticalAlignment = ExcelVerticalAlignment.Center;

            ws.Cells[25, 1, 25 + countPos, 10].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
            ws.Cells[25, 1, 25 + countPos, 10].Style.Border.Top.Style = ExcelBorderStyle.Thin;
            ws.Cells[25, 1, 25 + countPos, 10].Style.Border.Left.Style = ExcelBorderStyle.Thin;
            ws.Cells[25, 1, 25 + countPos, 10].Style.Border.Right.Style = ExcelBorderStyle.Thin;

            ws.Cells[25 + countPos, 5].Value = @"ИТОГО:";
            ws.Cells[25 + countPos, 5, 25 + countPos, 7].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
            ws.Cells[25 + countPos, 5, 25 + countPos, 7].Style.Border.Top.Style = ExcelBorderStyle.Thin;
            ws.Cells[25 + countPos, 5, 25 + countPos, 7].Style.Border.Left.Style = ExcelBorderStyle.Thin;
            ws.Cells[25 + countPos, 5, 25 + countPos, 7].Style.Border.Right.Style = ExcelBorderStyle.Thin;

            ws.Cells[25 + countPos, 6].Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;

            ws.Cells[25 + countPos, 6].Formula = @"=" + ws.Cells[26, 6].Address;
            ws.Cells[25 + countPos, 6].Style.Numberformat.Format = "0";

            ws.Cells[25 + countPos, 7].CreateArrayFormula($"SUM({ws.Cells[26, 7].Address}:{ws.Cells[25 + countPos - 1, 7]})");
            ws.Cells[25 + countPos, 7].Style.Numberformat.Format = "0.00";

            ws.Cells[25 + countPos, 8].Value = @" V= ";
            ws.Cells[25 + countPos, 8, 25 + countPos, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[25 + countPos, 9, 25 + countPos, 10].Merge = true;
            ws.Cells[25 + countPos, 9, 25 + countPos, 10].Formula = "=" + ws.Cells[25, 8].Address + "*" + ws.Cells[25, 9].Address + "*" + ws.Cells[25, 10].Address + "/1000000";
            ws.Cells[25 + countPos, 9, 25 + countPos, 10].Style.Numberformat.Format = "0.000";

            ws.Cells[26 + countPos + 1, 1, 26 + countPos + 1, 10].Merge = true;
            ws.Cells[26 + countPos + 1, 1, 26 + countPos + 1, 10].Value = @"Указанный в настоящем документе товар соответствует по качеству действующим в Российской Федерации стандартам и техническим условиям.";
            ws.Cells[26 + countPos + 1, 1, 26 + countPos + 1, 10].Style.Font.Size = 9;
            var startTable = 26 + countPos + 3;

            ws.Cells[startTable, 2].Value = "Покупатель:";
            ws.Cells[startTable, 2].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable, 3, startTable, 10].Merge = true;
            ws.Cells[startTable, 3, startTable, 10].Formula = "=" + ws.Cells[8, 1].Address;
            ws.Cells[startTable, 3, startTable, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 1, 2].Value = "Договор:";
            ws.Cells[startTable + 1, 2].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 1, 3, startTable + 1, 10].Merge = true;
            ws.Cells[startTable + 1, 3, startTable + 1, 10].Value = order.ShortContract;
            ws.Cells[startTable + 1, 3, startTable + 1, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 2, 2].Value = "Грузополучатель:";
            ws.Cells[startTable + 2, 2].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 2, 3, startTable + 2, 10].Merge = true;
            ws.Cells[startTable + 2, 3, startTable + 2, 10].Formula = "=" + ws.Cells[8, 1].Address;
            ws.Cells[startTable + 2, 3, startTable + 2, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 3, 2].Value = "Пункт назначения:";
            ws.Cells[startTable + 3, 3, startTable + 3, 10].Merge = true;
            ws.Cells[startTable + 3, 3, startTable + 3, 10].Formula = "=" + ws.Cells[9, 1].Address;
            ws.Cells[startTable + 3, 3, startTable + 3, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 4, 2].Value = "Поставщик:";
            ws.Cells[startTable + 4, 3, startTable + 4, 10].Merge = true;
            ws.Cells[startTable + 4, 3, startTable + 4, 10].Formula = "=" + ws.Cells[4, 1].Address;
            ws.Cells[startTable + 4, 3, startTable + 4, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 5, 2].Value = "Адрес:";
            ws.Cells[startTable + 5, 3, startTable + 5, 10].Merge = true;
            ws.Cells[startTable + 5, 3, startTable + 5, 10].Formula = "=" + ws.Cells[5, 1].Address;
            ws.Cells[startTable + 5, 3, startTable + 5, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 6, 2].Value = "Грузоотправитель:";
            ws.Cells[startTable + 6, 3, startTable + 6, 10].Merge = true;
            ws.Cells[startTable + 6, 3, startTable + 6, 10].Formula = "=" + ws.Cells[4, 1].Address;
            ws.Cells[startTable + 6, 3, startTable + 6, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 7, 2].Value = "Место №:";
            ws.Cells[startTable + 7, 3, startTable + 7, 10].Merge = true;
            ws.Cells[startTable + 7, 3, startTable + 7, 10].Formula = "=" + ws.Cells[4, 1].Address;
            ws.Cells[startTable + 7, 3, startTable + 7, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 8, 2].Value = "Вес, кг:";
            ws.Cells[startTable + 8, 2].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 8, 3].Value = "Брутто";
            ws.Cells[startTable + 8, 3].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 8, 4].Formula = ws.Cells[25 + countPos, 6].Address;
            ws.Cells[startTable + 8, 4].Style.Numberformat.Format = "0";
            ws.Cells[startTable + 8, 4].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 8, 5].Value = "Нетто";
            ws.Cells[startTable + 8, 5].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 8, 6].Formula = ws.Cells[25 + countPos, 7].Address;
            ws.Cells[startTable + 8, 6].Style.Numberformat.Format = "0";
            ws.Cells[startTable + 8, 6].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 8, 7, startTable + 8, 10].Merge = true;
            ws.Cells[startTable + 8, 7, startTable + 8, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 9, 2].Value = "Габаритные размеры";
            ws.Cells[startTable + 9, 2].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 9, 3, startTable + 9, 10].Merge = true;
            ws.Cells[startTable + 9, 3, startTable + 9, 10].Formula = "=" + ws.Cells[25, 8].Address + "&\"x\"&" + ws.Cells[25, 9].Address + "&\"x\"&" + ws.Cells[25, 10];
            ws.Cells[startTable + 9, 3, startTable + 9, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);

            ws.Cells[startTable + 10, 2].Value = "Место №";
            ws.Cells[startTable + 10, 2].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 10, 3, startTable + 10, 10].Merge = true;
            ws.Cells[startTable + 10, 3, startTable + 10, 10].Style.Border.BorderAround(ExcelBorderStyle.Thin);
            ws.Cells[startTable + 10, 3, startTable + 10, 10].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
            ws.Cells[startTable + 10, 3, startTable + 10, 10].Formula = "=" + ws.Cells[3, 10].Address;

            ws.Cells[startTable, 1, startTable + 10, 1].Merge = true;
            ws.Cells[startTable, 1, startTable + 10, 1].Value = "Маркировка";
            ws.Cells[startTable, 1, startTable + 10, 1].Style.TextRotation = 90;
            ws.Cells[startTable, 1, startTable + 10, 1].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            ws.Cells[startTable, 1, startTable + 10, 1].Style.VerticalAlignment = ExcelVerticalAlignment.Center;


            startTable = startTable + 11;

            ws.Cells[startTable, 6].Value = "Подписи:";
            ws.Cells[startTable + 1, 6, startTable + 1, 7].Merge = true;
            ws.Cells[startTable + 1, 6].Value = "Инженер по качеству:";

            ws.Cells[startTable + 1, 9, startTable + 1, 11].Merge = true;
            ws.Cells[startTable + 1, 9].Value = packingList.FioOtk;

            ws.Cells[startTable + 3, 6, startTable + 3, 7].Merge = true;
            ws.Cells[startTable + 3, 6].Value = "Мастер:";
            ws.Cells[startTable + 3, 9, startTable + 3, 11].Merge = true;
            ws.Cells[startTable + 3, 9].Value = packingList.FioMaster;

            ws.Cells[startTable + 5, 6, startTable + 5, 7].Merge = true;
            ws.Cells[startTable + 5, 6].Value = "Менеджер по продажам:";
            ws.Cells[startTable + 5, 9, startTable + 5, 11].Merge = true;
            ws.Cells[startTable + 5, 9].Value = packingList.FioManager;

            ws.Cells[startTable + 7, 6, startTable + 7, 8].Merge = true;
            ws.Cells[startTable + 7, 6].Value = "\"_____\" ___________ " + DateTime.Now.Year + "г.";
        }
 public PackingList InsertPackingList(TicketAutUser ticket, PackingList doc)
 {
     _logger.Trace("Trace method Insert for document: {0}. User: {1}", typeof(PackingList).Name, ticket);
     _dataManagers.Insert(doc, ticket);
     return(doc);
 }
 public void DeletePackingList(TicketAutUser ticket, PackingList doc)
 {
     _logger.Trace("Trace method Delete for document: {0}. Id: {2}. User: {1}", typeof(PackingList).Name, ticket, doc.Id);
     _dataManagers.Delete(doc, ticket);
 }
Example #20
0
 public PackingList Create(PackingList packingList)
 {
     _context.PackingLists.Add(packingList);
     return(packingList);
 }
 public List <HistoryRecord <PackingList> > GetHistoryDocPackingList(PackingList doc)
 {
     _logger.Trace("Trace method GetHistoryList for document: {0}", typeof(PackingList).Name);
     return(_historyManager.GetHistoryDoc(doc));
 }
    /// <summary>
    /// The method checks if the fields are empty and if not generates a new itemmodel with the
    /// values from the fields. Also saves a journey in the .json-File and generates the packinglistitems
    /// </summary>
    public void UpdateItem()
    {
        //DateTime dt;
        int resultInt;

        if (string.IsNullOrEmpty(MName.text))
        {
            SSTools.ShowMessage("Please enter name", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }
        else if (string.IsNullOrEmpty(mDate.text))
        {
            SSTools.ShowMessage("Please enter date", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }

        /*else if (!DateTime.TryParseExact(mDate.text, "dd.MM.yyyy - dd.MM.yyyy", CultureInfo.InvariantCulture,
         *                             DateTimeStyles.None, out dt))
         * {
         *  SSTools.ShowMessage("Please enter in format dd.mm.jjjj - dd.mm.jjjj", SSTools.Position.bottom, SSTools.Time.twoSecond);
         * }*/
        else if (string.IsNullOrEmpty(geld.text))
        {
            SSTools.ShowMessage("Please enter budget", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }
        else if (!int.TryParse(geld.text, out resultInt))
        {
            SSTools.ShowMessage("budget in numbers", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }
        else
        {
            sortedDictionaryPacking = new SortedDictionary <string, bool>();
            sortedDictionaryPacking.Add("Auslandswährung", false);
            sortedDictionaryPacking.Add("Bargeld", false);
            sortedDictionaryPacking.Add("Bauch-/Gürteltasche", false);
            sortedDictionaryPacking.Add("Handtasche", false);
            sortedDictionaryPacking.Add("Rucksack", false);
            sortedDictionaryPacking.Add("EC-Karte", false);
            sortedDictionaryPacking.Add("Geldversteck", false);
            sortedDictionaryPacking.Add("Kreditkarte", false);
            sortedDictionaryPacking.Add("Portmonee", false);

            sortedDictionaryPacking.Add("Apres Lotion", false);
            sortedDictionaryPacking.Add("Haarbürste/Kamm", false);
            sortedDictionaryPacking.Add("Deodorant", false);
            sortedDictionaryPacking.Add("Shampoo", false);
            sortedDictionaryPacking.Add("Haarkur", false);
            sortedDictionaryPacking.Add("Haargummi", false);
            sortedDictionaryPacking.Add("Handcreme", false);
            sortedDictionaryPacking.Add("Kontaktlinsen + Zubehör", false);
            sortedDictionaryPacking.Add("Kulturtasche", false);
            sortedDictionaryPacking.Add("Labello", false);
            sortedDictionaryPacking.Add("Nagelpflegeset", false);
            sortedDictionaryPacking.Add("Wattestäbchen", false);
            sortedDictionaryPacking.Add("Rasierer", false);
            sortedDictionaryPacking.Add("Make-up/Make-up-Entferner", false);
            sortedDictionaryPacking.Add("Sonnencreme", false);
            sortedDictionaryPacking.Add("Damenhygieneartikel (Tampons etc.)", false);
            sortedDictionaryPacking.Add("Taschentücher", false);
            sortedDictionaryPacking.Add("Verhütungsmittel", false);
            sortedDictionaryPacking.Add("Zahnbürste", false);
            sortedDictionaryPacking.Add("Zahnpasta", false);

            sortedDictionaryPacking.Add("Badesachen", false);
            sortedDictionaryPacking.Add("Fleecepullover", false);
            sortedDictionaryPacking.Add("Gürtel", false);
            sortedDictionaryPacking.Add("Hosen/Shorts, kurz", false);
            sortedDictionaryPacking.Add("Hosen/Jeans, lang", false);
            sortedDictionaryPacking.Add("Kleid", false);
            sortedDictionaryPacking.Add("Rock", false);
            sortedDictionaryPacking.Add("Mütze/Cap/Hüte", false);
            sortedDictionaryPacking.Add("Pullover/Sweatshirt", false);
            sortedDictionaryPacking.Add("Regenjacke/Regencape", false);
            sortedDictionaryPacking.Add("Schlafanzug", false);
            sortedDictionaryPacking.Add("Socken", false);
            sortedDictionaryPacking.Add("Schuhe", false);
            sortedDictionaryPacking.Add("Sonnenbrille", false);
            sortedDictionaryPacking.Add("Trekkinghose", false);
            sortedDictionaryPacking.Add("T-Shirts", false);
            sortedDictionaryPacking.Add("Unterwäsche", false);
            sortedDictionaryPacking.Add("Wander-/Funktionssocken", false);

            sortedDictionaryPacking.Add("Medikamente", false);

            sortedDictionaryPacking.Add("ADAC Unterlagen", false);
            sortedDictionaryPacking.Add("Adressliste für Postkarten", false);
            sortedDictionaryPacking.Add("Auslandskrankenversicherung", false);
            sortedDictionaryPacking.Add("Führerschein", false);
            sortedDictionaryPacking.Add("Hotel-/Hostelunterlagen", false);
            sortedDictionaryPacking.Add("Impfpass", false);
            sortedDictionaryPacking.Add("Karte", false);
            sortedDictionaryPacking.Add("Krankenversichertenkarte", false);
            sortedDictionaryPacking.Add("Mietwagenunterlagen", false);
            sortedDictionaryPacking.Add("Personalausweis", false);
            sortedDictionaryPacking.Add("Reiseführer", false);
            sortedDictionaryPacking.Add("Reisepass", false);
            sortedDictionaryPacking.Add("Reisetagebuch", false);
            sortedDictionaryPacking.Add("Studentenausweis", false);
            sortedDictionaryPacking.Add("Tauchnachweis/Segelschein/etc.", false);
            sortedDictionaryPacking.Add("Visum", false);
            sortedDictionaryPacking.Add("Wegbeschreibung", false);
            sortedDictionaryPacking.Add("Zugticket/Bahncard/Flugticket", false);

            sortedDictionaryPacking.Add("aufblasbares Kopfkissen", false);
            sortedDictionaryPacking.Add("Brille + Etui", false);
            sortedDictionaryPacking.Add("Buch/Zeitschrift", false);
            sortedDictionaryPacking.Add("Kofferanhänger", false);
            sortedDictionaryPacking.Add("Luftpumpe", false);
            sortedDictionaryPacking.Add("Ohrstöpsel", false);
            sortedDictionaryPacking.Add("Regenschirm", false);
            sortedDictionaryPacking.Add("Reisehandtücher", false);
            sortedDictionaryPacking.Add("Schreibzeug", false);
            sortedDictionaryPacking.Add("Spiele", false);
            sortedDictionaryPacking.Add("Taschenlampe", false);

            sortedDictionaryPacking.Add("Liege", false);
            sortedDictionaryPacking.Add("Schnorchelausrüstung", false);
            sortedDictionaryPacking.Add("Sonnenschirm", false);
            sortedDictionaryPacking.Add("Strandmuschel", false);
            sortedDictionaryPacking.Add("Strandtuch", false);
            sortedDictionaryPacking.Add("Windschutz", false);

            sortedDictionaryPacking.Add("Kamera", false);
            sortedDictionaryPacking.Add("eBook-Reader", false);
            sortedDictionaryPacking.Add("Handy + Ladekabel", false);
            sortedDictionaryPacking.Add("wasserdichte Handyhülle", false);
            sortedDictionaryPacking.Add("Kopfhörer", false);
            sortedDictionaryPacking.Add("Ladegeräte", false);
            sortedDictionaryPacking.Add("Powerbank", false);
            sortedDictionaryPacking.Add("Speicherkarten", false);
            sortedDictionaryPacking.Add("Selfie-Stick", false);
            sortedDictionaryPacking.Add("Steckdosenadapter", false);
            sortedDictionaryPacking.Add("Boxen", false);


            packingList = new PackingList(sortedDictionaryPacking);



            sortedDictionaryBudget = new SortedDictionary <string, int>();
            budget   = new Budget(int.Parse(geld.text), sortedDictionaryBudget);
            airplane = new List <Airplane>();
            train    = new List <Train>();
            bus      = new List <Bus>();

            path = PlayerPrefs.GetString("path");

            journey = new Journey(MName.text, mDate.text, path, packingList, budget, airplane, train, bus);
            var result = new ItemModel();
            result.date = mDate.text;
            result.name = MName.text;
            //result.name = journey.GetName();
            OnReceiveNewModel(result);
            SaveToJSON save = new SaveToJSON();
            journeys.Add(journey);
            save.SaveJourney(journeys);
        }
    }
Example #23
0
        /// <summary>
        /// update packing list
        /// </summary>
        /// <param name="packingList"></param>
        /// <returns></returns>
        public OperationResult UpdatePackingList(PackingList packingList)
        {
            var operationResult = new OperationResult();

            var existingPackingList = GetPackingList(packingList.PackingListId);

            if (existingPackingList != null)
            {
                logger.Debug("PackingList is being updated.");

                try
                {
                    _db.PackingList.Attach(existingPackingList);

                    _db.Entry(existingPackingList).CurrentValues.SetValues(packingList);

                    _db.SaveChanges();

                    var existingParts = _db.PackingListPart.Where(x => x.PackingListId == packingList.PackingListId).ToList();

                    if (packingList.PackingListParts != null && packingList.PackingListParts.Count() > 0)
                    {
                        foreach (var part in packingList.PackingListParts)
                        {
                            var existingPart = _db.PackingListPart.FirstOrDefault(x => x.PackingListPartId == part.PackingListPartId);

                            if (existingPart != null)
                            {
                                _db.PackingListPart.Attach(existingPart);

                                existingPart.ShipCode            = part.ShipCode;
                                existingPart.PartNumber          = part.PartNumber;
                                existingPart.PalletNumber        = part.PalletNumber;
                                existingPart.PalletQuantity      = part.PalletQuantity;
                                existingPart.PalletWeight        = part.PalletWeight;
                                existingPart.PalletTotal         = part.PalletTotal;
                                existingPart.TotalPalletQuantity = part.TotalPalletQuantity;
                                existingPart.PONumber            = part.PONumber;
                                existingPart.InvoiceNumber       = part.InvoiceNumber;
                            }
                            _db.SaveChanges();
                        }
                    }

                    if (existingParts != null && existingParts.Count > 0)
                    {
                        foreach (var part in existingParts)
                        {
                            var existingPart = packingList.PackingListParts.FirstOrDefault(x => x.PackingListPartId == part.PackingListPartId);

                            if (existingPart == null)
                            {
                                _db.PackingListPart.Remove(part);

                                _db.SaveChanges();
                            }
                        }
                    }

                    operationResult.Success = true;
                    operationResult.Message = "Success";
                }
                catch (Exception ex)
                {
                    operationResult.Success = false;
                    operationResult.Message = "Error";
                    logger.ErrorFormat("Error while updating packing list: { 0} ", ex.ToString());
                }
            }
            else
            {
                operationResult.Success = false;
                operationResult.Message = "Unable to find selected packing list.";
            }

            return(operationResult);
        }
 public void Save(PackingList task)
 {
     _dataManagersFactory.GetDataManager<PackingList>().InsertOrUpdate(task);
 }
Example #25
0
        // GET: PackingLists/Create
        public ActionResult Create()
        {
            PackingList objDept = new PackingList();

            return(PartialView("CreatepackingList", objDept));
        }
Example #26
0
        protected void RefreshPage(int modelid, int vpm, int rictype)
        {
            PackingList pl = RicRepository.GetPackingList(modelid, vpm, rictype);

            if (pl != null)
            {
                imgUploadPL.ImageUrl = "/Content/Images/status-green.png";
                imgUploadPL.Visible  = true;
                lblPL.Text           = "Filename: " + pl.FileName + "; Lot: " + pl.LotNos + "; Upload Date: " + pl.CreatedDate;
            }
            else
            {
                imgUploadPL.ImageUrl = "/Content/Images/status-red.png";
                imgUploadPL.Visible  = true;
                lblPL.Text           = "No packing list uploaded.";
            }

            RIC ric = RicRepository.GetRIC(modelid, vpm, rictype);

            if (ric != null && ric.CompareDate != null && ric.CompareDate.Value > pl.CreatedDate)
            {
                imgComparePL.ImageUrl = "/Content/Images/status-green.png";
                imgComparePL.Visible  = true;
                lblComparePL.Text     = "RICNr: " + ric.RICNr + "; Compare Date: " + ric.CompareDate;

                if (ric.StatusId != EStatus.Draft)
                {
                    imgReleaseRic.ImageUrl = "/Content/Images/status-green.png";
                    imgReleaseRic.Visible  = true;
                    lblReleaseRIC.Text     = "RICNr: " + ric.RICNr + "; Released Date: " + ric.IssuedDate;
                }
                else
                {
                    imgReleaseRic.ImageUrl = "/Content/Images/status-red.png";
                    imgReleaseRic.Visible  = true;
                    lblReleaseRIC.Text     = "No RIC";
                }
            }
            else
            {
                imgComparePL.ImageUrl = "/Content/Images/status-red.png";
                imgComparePL.Visible  = true;
                lblComparePL.Text     = "No RIC";

                imgReleaseRic.ImageUrl = "/Content/Images/status-red.png";
                imgReleaseRic.Visible  = true;
                lblReleaseRIC.Text     = "No RIC";
            }

            callback.JSProperties["cpResult"] = "";

            if (ric == null)
            {
                hdField["status"] = 0;
            }
            else
            {
                hdField["status"] = (int)ric.StatusId;
            }

            cmbModels.Enabled      = false;
            dtPackingMonth.Enabled = false;
            cmbRicType.Enabled     = false;
        }
Example #27
0
        protected void callback_Callback(object sender, CallbackEventArgsBase e)
        {
            string[] str = e.Parameter.Split(";");
            if (str.Length < 4)
            {
                return;
            }

            if (str[0] == "release")
            {
                int modelid = str[1].ToInt32(0);
                int vpm     = str[2].ToInt32(0);
                int rictype = str[3].ToInt32(0);

                try
                {
                    RicRepository.ReleaseRIC(modelid, vpm, rictype);
                    callback.JSProperties["cpResult"] = "RIC successfully released";
                }
                catch (Exception ex)
                {
                    callback.JSProperties["cpResult"] = ex.Message;
                }

                PackingList pl = RicRepository.GetPackingList(modelid, vpm, rictype);
                if (pl != null)
                {
                    imgUploadPL.ImageUrl = "/Content/Images/status-green.png";
                    imgUploadPL.Visible  = true;
                    lblPL.Text           = "Filename: " + pl.FileName + "; Lot: " + pl.LotNos + "; Upload Date: " + pl.CreatedDate;
                }
                else
                {
                    imgUploadPL.ImageUrl = "/Content/Images/status-red.png";
                    imgUploadPL.Visible  = true;
                    lblPL.Text           = "No packing list uploaded.";
                }

                RIC ric = RicRepository.GetRIC(modelid, vpm, rictype);
                if (ric != null && ric.CompareDate != null && ric.CompareDate.Value > pl.CreatedDate)
                {
                    imgComparePL.ImageUrl = "/Content/Images/status-green.png";
                    imgComparePL.Visible  = true;
                    lblComparePL.Text     = "RICNr: " + ric.RICNr + "; Compare Date: " + ric.CompareDate;

                    if (ric.StatusId != EStatus.Draft)
                    {
                        imgReleaseRic.ImageUrl = "/Content/Images/status-green.png";
                        imgReleaseRic.Visible  = true;
                        lblReleaseRIC.Text     = "RICNr: " + ric.RICNr + "; Released Date: " + ric.IssuedDate;
                    }
                    else
                    {
                        imgReleaseRic.ImageUrl = "/Content/Images/status-red.png";
                        imgReleaseRic.Visible  = true;
                        lblReleaseRIC.Text     = "No RIC";
                    }
                }
                else
                {
                    imgComparePL.ImageUrl = "/Content/Images/status-red.png";
                    imgComparePL.Visible  = true;
                    lblComparePL.Text     = "No RIC";

                    imgReleaseRic.ImageUrl = "/Content/Images/status-red.png";
                    imgReleaseRic.Visible  = true;
                    lblReleaseRIC.Text     = "No RIC";
                }

                if (ric == null)
                {
                    hdField["status"] = 0;
                }
                else
                {
                    hdField["status"] = (int)ric.StatusId;
                }
            }
            else if (str[0] == "refresh")
            {
                int modelid = str[1].ToInt32(0);
                int vpm     = str[2].ToInt32(0);
                int rictype = str[3].ToInt32(0);
                RefreshPage(modelid, vpm, rictype);
            }
        }
        /// <summary>
        /// Function for Printing a Packing List Report. This function will take 2 parameter CustomerNo,PackingListNo.
        /// Created By: Lalit
        /// Created Date: 19july 2013
        /// </summary>
        public string PrintPackingList(Stream PackingListParm)
        {
            string File = "";

            try
            {
                string[]    Ht = new string[2];
                PackingList _ObjPackingList = new PackingList();
                _ObjPackingList            = JsonHelper.DeserializeObj <PackingList>(PackingListParm);
                _Obj_Conn.ConnectionString = con.ConnectionString;
                string _CustNo   = _ObjPackingList.CustomerNo;
                string _PckLstNo = _ObjPackingList.PackingListNo;
                cmd      = new SqlCommand();
                Sql      = @"Select * from View_PackingLst where InvNo = '" + _PckLstNo + "' and CustomerCode ='" + _CustNo + "' Order By Type, Micron, Width";
                _Obj_SDA = new SqlDataAdapter(Sql, _Obj_Conn);
                _Obj_SDA.Fill(ds, "View_PackingLst");
                Sql = "select distinct VrYr + COANo as CoaNo From Dbo.TblCOa Where InvNo = '" + ds.Tables["View_PackingLst"].Rows[0]["RrNumber"].ToString().Trim() + "'";
                DataTable xDt = objdatacommon.ExecuteSqlQry(Sql);
                if (xDt != null && xDt.Rows.Count > 0)
                {
                    xCoa = "";
                    for (int x = 0; x < xDt.Rows.Count; x++)
                    {
                        if (xCoa == "")
                        {
                            xCoa = xDt.Rows[x]["COANo"].ToString();
                        }
                        else
                        {
                            xCoa += ", " + xDt.Rows[x]["COANo"].ToString();
                        }
                    }
                }
                else
                {
                    xCoa = "";
                }
                int xUom = Convert.ToInt16(ds.Tables["View_PackingLst"].Rows[0]["UOMId"]);
                if (xUom > 101)
                {
                    for (int x = 0; x < ds.Tables["View_PackingLst"].Rows.Count; x++)
                    {
                        if (xUom == 180)
                        {
                            ds.Tables["View_PackingLst"].Rows[x]["Lbs"] = Convert.ToDecimal(ds.Tables["View_PackingLst"].Rows[x]["NoOfRolls"].ToString());
                        }
                        else
                        {
                            ds.Tables["View_PackingLst"].Rows[x]["Lbs"] = Convert.ToDecimal(ds.Tables["View_PackingLst"].Rows[x]["OuQty"].ToString());
                        }
                    }
                    ds.Tables["View_PackingLst"].AcceptChanges();
                }

                Sql      = "select '' as DeliveryToName,'' as DlvAddress,'' as DlvCity,'' as DlvStateName,'' as DlvZip,'' as DlvCountryName,'' as City,* from Com_SalesOrgnization_Mst where SalesOrgCode = 'PCL-US'";
                _Obj_SDA = new SqlDataAdapter(Sql, _Obj_Conn);
                _Obj_SDA.Fill(ds, "Com_SalesOrgnization_Mst");

                Sql = @"Select d.DeliveryToName, d.address, d.City, d.StateName, d.Zip, d.CountryName 
                    From dbo.Sal_Glb_OrderInformations o inner join view_deliveryto d 
                    on d.DeliveryToID = o.SODeliveryTo 
                    Where sono = '" + ds.Tables["View_PackingLst"].Rows[0]["SalesOrdNo"] + "'";

                _Obj_SDA = new SqlDataAdapter(Sql, _Obj_Conn);
                int i = _Obj_SDA.Fill(ds, "DlvMst");

                if (i > 0)
                {
                    ds.Tables["Com_SalesOrgnization_Mst"].Rows[0]["DeliveryToName"] = ds.Tables["DlvMst"].Rows[0]["DeliveryToName"];
                    ds.Tables["Com_SalesOrgnization_Mst"].Rows[0]["DlvAddress"]     = ds.Tables["DlvMst"].Rows[0]["address"];
                    ds.Tables["Com_SalesOrgnization_Mst"].Rows[0]["DlvCity"]        = ds.Tables["DlvMst"].Rows[0]["City"];
                    ds.Tables["Com_SalesOrgnization_Mst"].Rows[0]["DlvStateName"]   = ds.Tables["DlvMst"].Rows[0]["StateName"].ToString().Trim();
                    ds.Tables["Com_SalesOrgnization_Mst"].Rows[0]["DlvZip"]         = ", " + ds.Tables["DlvMst"].Rows[0]["Zip"];
                    ds.Tables["Com_SalesOrgnization_Mst"].Rows[0]["DlvCountryName"] = ds.Tables["DlvMst"].Rows[0]["CountryName"];
                    ds.Tables["Com_SalesOrgnization_Mst"].Rows[0]["City"]           = xCoa.Trim();
                    ds.Tables["Com_SalesOrgnization_Mst"].AcceptChanges();
                }
                if (ds.Tables["Com_SalesOrgnization_Mst"].Rows.Count > 0)
                {
                    rptDoc.Load(ReportpathPackList);
                    rptDoc.SetDataSource(ds);
                    ExportOptions           exportOpts = new ExportOptions();
                    PdfRtfWordFormatOptions pdfOpts    = ExportOptions.CreatePdfRtfWordFormatOptions();
                    exportOpts.ExportFormatType    = ExportFormatType.PortableDocFormat;
                    exportOpts.ExportFormatOptions = pdfOpts;
                    _FlName = Guid.NewGuid().ToString() + ".pdf";
                    rptDoc.ExportToDisk(ExportFormatType.PortableDocFormat, (FileToSavepath + _FlName));
                    Ht[0] = FileAccessPath;
                    Ht[1] = _FlName;
                    File  = JsonHelper.JsonSerializer <string[]>(Ht);
                    rptDoc.Dispose();
                }
                con.CloseConnection();
                con.DisposeConnection();
                _Obj_SDA.Dispose();
                cmd.Dispose();
                ds.Dispose();
            }
            catch (Exception ex) {  }
            return(File);
        }
        // GET api/dummycargargridpackinglist
        public GridCuantificacion Get(string gridPackingList, string username, string token)
        {
            GridCuantificacion           GridCuantificacion = new GridCuantificacion();
            List <ListadoCuantificacion> lstCuantificacion  = new List <ListadoCuantificacion>();
            ListadoCuantificacion        cuantificacion     = new ListadoCuantificacion();
            PackingList           packingList     = new PackingList();
            ListadoCuantificacion cuantificacion1 = new ListadoCuantificacion();
            ListadoCuantificacion cuantificacion2 = new ListadoCuantificacion();
            ListadoCuantificacion cuantificacion3 = new ListadoCuantificacion();

            cuantificacion.ItemCode        = "AAC957927OOY";
            cuantificacion.Descripcion     = "Brida";
            cuantificacion.D1              = 10;
            cuantificacion.D2              = 2;
            cuantificacion.ItemCodeSteelgo = "AAC957927OOY-1";
            cuantificacion.Familia         = "Brida";
            cuantificacion.Cedula          = "STD";
            cuantificacion.TipoAcero       = "CS";
            cuantificacion.Colada          = "Colada1";
            cuantificacion.Cantidad        = 3;
            cuantificacion.MM              = 11;
            cuantificacion.Detallar        = "No";
            cuantificacion.TieneNU         = true;
            cuantificacion.TieneError      = false;
            lstCuantificacion.Add(cuantificacion);

            cuantificacion1.ItemCode        = "AAC957927OOZ";
            cuantificacion1.Descripcion     = "Sockolet";
            cuantificacion1.D1              = 8;
            cuantificacion1.D2              = 0;
            cuantificacion1.ItemCodeSteelgo = "AAC957927OOZ-2";
            cuantificacion1.Familia         = "";
            cuantificacion1.Cedula          = "";
            cuantificacion1.TipoAcero       = "";
            cuantificacion1.Colada          = "";
            cuantificacion1.Cantidad        = 150;
            cuantificacion1.MM              = 151;
            cuantificacion1.Detallar        = "No";
            cuantificacion1.TieneNU         = false;
            cuantificacion1.TieneError      = false;
            lstCuantificacion.Add(cuantificacion1);

            cuantificacion2.ItemCode        = "AAC957927OOX";
            cuantificacion2.Descripcion     = "Codo45";
            cuantificacion2.D1              = 10;
            cuantificacion2.D2              = 0;
            cuantificacion2.ItemCodeSteelgo = "AAC957927OOX-3";
            cuantificacion2.Familia         = "Codo";
            cuantificacion2.Cedula          = "STD";
            cuantificacion2.TipoAcero       = "SS";
            cuantificacion2.Colada          = "SS1";
            cuantificacion2.Cantidad        = 1;
            cuantificacion2.MM              = 2;
            cuantificacion2.Detallar        = "No";
            cuantificacion2.TieneNU         = true;
            cuantificacion2.TieneError      = false;
            lstCuantificacion.Add(cuantificacion2);


            cuantificacion3.ItemCode        = "AAC957927OOT";
            cuantificacion3.Descripcion     = "ARNIKA";
            cuantificacion3.D1              = 9;
            cuantificacion3.D2              = 1;
            cuantificacion3.ItemCodeSteelgo = "AAC957927OOT-4";
            cuantificacion3.Familia         = "ALTA";
            cuantificacion3.Cedula          = "ASDA";
            cuantificacion3.TipoAcero       = "ABRICA";
            cuantificacion3.Colada          = "a1";
            cuantificacion3.Cantidad        = 160;
            cuantificacion3.MM              = 161;
            cuantificacion3.Detallar        = "No";
            cuantificacion3.TieneNU         = false;
            cuantificacion3.TieneError      = false;
            lstCuantificacion.Add(cuantificacion3);

            packingList.PackingListID = "900";
            packingList.Consecutivo   = "1";

            GridCuantificacion.PackingList           = packingList;
            GridCuantificacion.ListadoCuantificacion = lstCuantificacion;
            return(GridCuantificacion);
        }
 public void Delete(PackingList doc)
 {
     _dataManagersFactory.GetDataManager<PackingList>().Delete(doc);
 }
Example #31
0
 public void PrintPackingListPMZ(PackingList packingList)
 {
     var order = _dataManagersFactory.GetDataManager<Order>().GetDocument(packingList.OrderId);
     _dataExport.CreatePackingListPMZ(order, packingList);
     _dataExport.SaveReport();
 }
Example #32
0
        /// <summary>
        /// convert packing list to view model
        /// </summary>
        /// <param name="packingList"></param>
        /// <returns></returns>
        public PackingListViewModel ConvertToView(PackingList packingList)
        {
            PackingListViewModel model = new PackingListViewModel();

            var _customerDynamicsRepository        = new CustomerDynamicsRepository();
            var _customerAddressDynamicsRepository = new CustomerAddressDynamicsRepository();
            var _stateRepository       = new StateRepository();
            var _carrierRepository     = new CarrierRepository();
            var _packingListRepository = new PackingListRepository();

            var dynamicsCustomer        = _customerDynamicsRepository.GetCustomer(packingList.CustomerId);
            var dynamicsCustomerAddress = _customerAddressDynamicsRepository.GetCustomerAddress(packingList.CustomerAddressId);
            var state     = _stateRepository.GetState((dynamicsCustomerAddress != null && !string.IsNullOrEmpty(dynamicsCustomerAddress.STATE)) ? dynamicsCustomerAddress.STATE : string.Empty);
            var stateName = (state != null && !string.IsNullOrEmpty(state.Name)) ? ", " + state.Name : string.Empty;
            var carrier   = _carrierRepository.GetCarrier(packingList.CarrierId);

            model.PackingListId     = packingList.PackingListId;
            model.CustomerId        = packingList.CustomerId;
            model.CustomerName      = (dynamicsCustomer != null && !string.IsNullOrEmpty(dynamicsCustomer.SHRTNAME)) ? dynamicsCustomer.SHRTNAME : "N/A";
            model.CustomerAddressId = packingList.CustomerAddressId;
            model.CustomerAddress   = (dynamicsCustomerAddress != null) ? dynamicsCustomerAddress.ADDRESS1 + " " +
                                      dynamicsCustomerAddress.CITY + ", " + stateName : "N/A";
            model.ShipDate        = packingList.ShipDate;
            model.ShipDateStr     = packingList.ShipDate.ToShortDateString();
            model.Freight         = packingList.Freight;
            model.CarrierId       = packingList.CarrierId;
            model.CarrierName     = (carrier != null && !string.IsNullOrEmpty(carrier.Name)) ? carrier.Name : "N/A";
            model.TrailerNumber   = (!string.IsNullOrEmpty(packingList.TrailerNumber)) ? packingList.TrailerNumber : "N/A";
            model.TrackingNumber  = (!string.IsNullOrEmpty(packingList.TrackingNumber)) ? packingList.TrackingNumber : "N/A";
            model.Notes           = (!string.IsNullOrEmpty(packingList.Notes)) ? packingList.Notes : "N/A";
            model.NetWeight       = packingList.NetWeight;
            model.GrossWeight     = packingList.GrossWeight;
            model.DeliveryDate    = (packingList.DeliveryDate != null) ? packingList.DeliveryDate : DateTime.MinValue;;
            model.DeliveryDateStr = (packingList.DeliveryDate != null) ? packingList.DeliveryDate.Value.ToShortDateString() : "N/A";
            model.IsClosed        = packingList.IsClosed;
            model.ClosedDate      = (packingList.ClosedDate != null) ? packingList.ClosedDate : DateTime.MinValue;
            model.ClosedDateStr   = (packingList.ClosedDate != null) ? packingList.ClosedDate.Value.ToShortDateString() : "N/A";
            model.CreatedDate     = (packingList.CreatedDate != null) ? packingList.CreatedDate : DateTime.MinValue;
            model.CreatedDateStr  = (packingList.CreatedDate != null) ? packingList.CreatedDate.Value.ToShortDateString() : "N/A";

            var parts = _packingListRepository.GetPackingListPartsByPackingList(packingList.PackingListId);

            if (parts != null && parts.Count > 0)
            {
                var packingListParts = new List <PackingListPartViewModel>();

                foreach (var part in parts)
                {
                    PackingListPartViewModel packingListPart = new PackingListPartConverter().ConvertToView(part);
                    packingListParts.Add(packingListPart);
                }

                model.PackingListParts = packingListParts.OrderBy(x => x.ShipCode).ThenBy(y => y.PartNumber).ThenBy(z => z.PalletNumber).ToList();
            }

            if (_customerDynamicsRepository != null)
            {
                _customerDynamicsRepository.Dispose();
                _customerDynamicsRepository = null;
            }

            if (_customerAddressDynamicsRepository != null)
            {
                _customerAddressDynamicsRepository.Dispose();
                _customerAddressDynamicsRepository = null;
            }

            if (_stateRepository != null)
            {
                _stateRepository.Dispose();
                _stateRepository = null;
            }

            if (_carrierRepository != null)
            {
                _carrierRepository.Dispose();
                _carrierRepository = null;
            }

            if (_packingListRepository != null)
            {
                _packingListRepository.Dispose();
                _packingListRepository = null;
            }

            return(model);
        }