private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            //Box Information
            String BoxNumber = Global.BoxNumberScanned;

            EBoxNumber = Global.BoxNumberScanned;

            //Package Information
            String ShippingNumber = Global.ShippingNumber;

            //Shipping information
            cstShippingTbl           shippingTbl     = Global.controller.GetShippingTbl(ShippingNumber);
            List <cstPackageDetails> _packingDetails = Global.controller.GetPackingDetailTbl(BoxNumber);

            model_Shipment _shipment = Global.controller.getModelShipment(ShippingNumber);

            string upccode = Global.controller.SKUnameToUPCCode(_packingDetails[Global.counter].SKUNumber);

            //String UPC_Code = _shipment.ShipmentDetailSage.SingleOrDefault(i => i.SKU == item.UPCCode).UPCCode;
            txtaddress.Text  = shippingTbl.ToAddressLine1 + shippingTbl.ToAddressLine2 + shippingTbl.ToAddressLine3 + shippingTbl.ToAddressCity + shippingTbl.ToAddressState + shippingTbl.ToAddressCountry + shippingTbl.ToAddressZipCode;
            txtponumber.Text = shippingTbl.CustomerPO;
            //  txtvendorname.Text = shippingTbl.VendorName;
            txtWH.Text         = Global.WH;
            txtupc.Text        = upccode;
            txtQty.Text        = _packingDetails[Global.counter].SKUQuantity.ToString();
            txtPartNumber.Text = _packingDetails[Global.counter].SKUNumber.ToString();
            txtCarton.Text     = GetCarton(BoxNumber);
            txtBoxNumber.Text  = GetBox(BoxNumber);
            UPCA upca = new UPCA();

            if (this.txtupc.Text.Length == 12)
            {
                this.txtupc.Text = this.txtupc.Text.Substring(0, 11) + upca.GetCheckSum(this.txtupc.Text).ToString();
                System.Drawing.Image img;
                img = upca.CreateBarCode(this.txtupc.Text, 3);

                var imges = new System.Drawing.Bitmap(img);

                var newimag = Imaging.CreateBitmapSourceFromHBitmap(imges.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());


                image.Source = newimag;
            }
            else
            {
                this.image.Source = null;
            }
        }
        /// <summary>
        /// catch Error Exception and show error on the main screen.
        /// </summary>
        private void _catchErrorInCondition()
        {
            try
            {
                //Distroy Shipment Object;
                model_Shipment _shipment = new model_Shipment();

                //Show Error message on the Strip;
                _scrollMsg("Warning: Please check the shipment ID! - \"" + txtShipmentId.Text + "\" is invalid.", Color.FromRgb(222, 87, 24));

                //clear the shipment textbox
                txtShipmentId.Text = "";
            }
            catch (Exception Ex)
            {
                //Log the Error to the Error Log table
                ErrorLoger.save("wndShipmentScanPage - _catchErrorInCondition", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId);
            }
        }
Example #3
0
 /// <summary>
 /// set shipping information related to the packing model packing ID.
 /// </summary>
 public void SetShipmentInfo()
 {
     ShipmentInfo = new model_Shipment(PackageInfo.ShippingNum);
 }
Example #4
0
        /// <summary>
        /// shipment model object with all informatin instance
        /// </summary>
        /// <param name="ShipmentNumber">String Shipment number</param>
        /// <returns>Object of shipment Model (mShipment)</returns>
        public model_Shipment getModelShipment(String ShipmentNumber)
        {
            model_Shipment _command = new model_Shipment(ShipmentNumber);

            return(_command);
        }
        /// <summary>
        /// Check for shipment Packed or not exist in the table .
        /// </summary>
        private void _saveClick()
        {
            BErrorMsg.Visibility = System.Windows.Visibility.Hidden;
            try
            {
                Global.PackingID      = Guid.Empty;
                Global.ShippingNumber = txtShipmentId.Text.ToUpper();

                //Get model of shipment;
                model_Shipment modelshipment        = Global.controller.getModelShipment(Global.ShippingNumber);
                String         ApplicationLocation  = Global.controller.ApplicationLocation();
                Boolean        ISSameLocationPacked = modelshipment.ShipmentFucntions.IsShipmentPackedAtSameLocation(modelshipment.PackedLocations, ApplicationLocation, modelshipment.IsAlreadyPacked);
                if (modelshipment.IsShipmentValidated)
                {
                    if (modelshipment.IsAlreadyPacked && ISSameLocationPacked)
                    {
                        List <cstPackageTbl> _lsPck = modelshipment.PackingInfo;
                        int      PackingStatus      = modelshipment.PackingInfo.FirstOrDefault(i => i.ShipmentLocation == ApplicationLocation).PackingStatus;
                        Guid     UserId             = modelshipment.PackingInfo.FirstOrDefault(i => i.ShipmentLocation == ApplicationLocation).UserID;
                        String   UserName           = modelshipment.UserInfo_ShipmentPackedBy.FirstOrDefault(i => i.UserID == UserId).UserFullName;
                        String   StationName        = Global.controller.GetStationMaster(modelshipment.PackingInfo[0].StationID).StationName;
                        DateTime PakedDate          = modelshipment.PackingInfo[0].EndTime;

                        #region single location packed
                        if (modelshipment.IsMultiLocation == false)
                        {
                            // if (PackingStatus == 1)
                            // {
                            //log.
                            SaveUserLogsTbl.logThis(csteActionType.ShipmentID_UnderPacking_Scan_00.ToString(), _lsPck[0].PackingId.ToString());

                            //if (UserId == Global.LoggedUserId)
                            if (true)
                            {
                                //if (modelshipment.CanOverride)
                                //{
                                //    //set mod to the SameUser packing the Shipment;
                                Global.Mode = "SameUser";
                                Global.SameUserpackingID = modelshipment.PackingInfo[0].PackingId;
                                this.Dispatcher.Invoke(new Action(() => { _show_Shipment(); }));
                                //    }
                                //    else
                                //    {
                                //        //Show Error message on the Strip;
                                //        _scrollMsg("Warning:\"" + txtShipmentId.Text + "\" is already overridden by you. Can not override shipment more than one.", Color.FromRgb(222, 87, 24));
                                //    }
                                //}
                                //else
                                //{
                                //    _scrollMsg("Warning: " + "'" + txtShipmentId.Text.ToUpper() + "' Shipment is under packing. user " + UserName + " is packing The Shipment at station  " + StationName, Color.FromRgb(222, 87, 24));
                                //    MsgBox.Show("Shipment", "Warning", "'" + txtShipmentId.Text.ToUpper() + "'" + Environment.NewLine + " Shipment is under packing." + Environment.NewLine + "user " + UserName + " is packing The Shipment at station  " + StationName);

                                //}
                                //_actMessageResult();
                                txtShipmentId.Text = "";
                            }
                            else if (PackingStatus == 0)
                            {
                                //log.
                                SaveUserLogsTbl.logThis(csteActionType.ShipmentID_AlreadyPacked_Scan_00.ToString(), _lsPck[0].PackingId.ToString());
                                //Distroy Shipment Object;
                                modelshipment = new model_Shipment();
                                _scrollMsg("Warning: " + "'" + txtShipmentId.Text + "'" + " Shipment is already packed  by  " + UserName + " on " + PakedDate.ToString("dddd,MMM dd, yyyy") + " at " + PakedDate.ToString("hh:mm:ss tt"), Color.FromRgb(222, 87, 24));
                                MsgBox.Show("Shipment", "Warning", "'" + txtShipmentId.Text + "'" + " Shipment is already packed " + Environment.NewLine + " by  " + UserName + Environment.NewLine + " on " + PakedDate.ToString("dddd,MMM dd, yyyy") + Environment.NewLine + " at " + PakedDate.ToString("hh:mm:ss tt"));
                                _actMessageResult();
                                txtShipmentId.Text = "";
                            }
                        }
                        #endregion
                        else if (modelshipment.IsMultiLocation)
                        {
                            //log.
                            SaveUserLogsTbl.logThis(csteActionType.MultiLocation_ShipmentIDScan.ToString());
                            Boolean LocationFound = false;
                            foreach (cstPackageTbl _packed in modelshipment.PackingInfo)
                            {
                                if (_packed.ShipmentLocation == ApplicationLocation)
                                {
                                    LocationFound = true;
                                    // if (_packed.PackingStatus == 1)
                                    //  {
                                    //log.
                                    SaveUserLogsTbl.logThis(csteActionType.ShipmentID_UnderPacking_Scan_00.ToString(), _lsPck[0].PackingId.ToString());

                                    //same User Override
                                    // if (UserId == Global.LoggedUserId)
                                    // {
                                    //set mod to the SameUser packing the Shipment;
                                    Global.Mode = "SameUser";
                                    Global.SameUserpackingID = _packed.PackingId;
                                    _show_Shipment();
                                    //  }
                                    //  else
                                    //  {
                                    //      _scrollMsg("Warning: " + "'" + txtShipmentId.Text.ToUpper() + "' Shipment is under packing. user " + UserName + " is packing The Shipment at station  " + StationName, Color.FromRgb(222, 87, 24));
                                    //      MsgBox.Show("Shipment", "Warning", "'" + txtShipmentId.Text.ToUpper() + "'" + Environment.NewLine + " Shipment is under packing." + Environment.NewLine + "user " + UserName + " is packing The Shipment at station  " + StationName);
                                    //  }
                                    //  _actMessageResult();
                                    txtShipmentId.Text = "";
                                    // break;
                                    // }
                                    if (_packed.PackingStatus == 0)
                                    {
                                        //log.
                                        SaveUserLogsTbl.logThis(csteActionType.ShipmentID_AlreadyPacked_Scan_00.ToString(), _lsPck[0].PackingId.ToString());
                                        //Distroy Shipment Object;
                                        modelshipment = new model_Shipment();
                                        MsgBox.Show("Shipment", "Warning", "'" + txtShipmentId.Text + "'" + " Shipment is already packed " + Environment.NewLine + " by  " + UserName + Environment.NewLine + " on " + PakedDate.ToString("dddd,MMM dd, yyyy") + Environment.NewLine + " at " + PakedDate.ToString("hh:mm:ss tt"));
                                        _scrollMsg("Warning: " + "'" + txtShipmentId.Text + "'" + " Shipment is already packed  by  " + UserName + " on " + PakedDate.ToString("dddd,MMM dd, yyyy") + " at " + PakedDate.ToString("hh:mm:ss tt"), Color.FromRgb(222, 87, 24));
                                        _actMessageResult();
                                        txtShipmentId.Text = "";
                                        break;
                                    }
                                }
                            }
                            if (LocationFound == false)
                            {
                                //Open Shipment Screen Directly.
                                _show_Shipment();
                            }
                        }
                    }
                    else if (modelshipment.ShipmentDetailSage == null || modelshipment.ShipmentDetailSage.Count <= 0)
                    {
                        //log.
                        SaveUserLogsTbl.logThis(csteActionType.Invalid_ShipmentScan__00.ToString(), txtShipmentId.Text);
                        //show error
                        _catchErrorInCondition();
                    }
                    else
                    {
                        Boolean Shown = false;
                        foreach (var sage in modelshipment.ShipmentDetailSage)
                        {
                            if (sage.Location == ApplicationLocation)
                            {
                                Shown = true;
                                _show_Shipment();
                                break;
                            }
                        }
                        if (Shown == false)
                        {
                            //Distroy Shipment Object;
                            modelshipment = new model_Shipment();

                            //Show Error message on the Strip;
                            _scrollMsg("Warning: Please check the shipment ID! - \"" + txtShipmentId.Text + "\" is not belongs to this location.", Color.FromRgb(222, 87, 24));

                            //clear the shipment textbox
                            txtShipmentId.Text = "";
                        }
                    }
                }
                else if (!modelshipment.IsShipmentValidated && modelshipment.ShipmentDetailSage.Count > 0)
                {
                    //Show error message.
                    _scrollMsg("Warning: Shipment Number: " + txtShipmentId.Text + " is already Shipped.", Color.FromRgb(222, 87, 24));
                    //clear the shipment textbox
                    txtShipmentId.Text = "";
                    //Distroy Shipment Object;
                    model_Shipment _shipment = new model_Shipment();
                }
                else
                {
                    //Show error message.
                    _scrollMsg("Warning: Shipment Number: " + txtShipmentId.Text + " is not valid. Please check Shipment Number.", Color.FromRgb(222, 87, 24));
                    //clear the shipment textbox
                    txtShipmentId.Text = "";
                    //Distroy Shipment Object;
                    model_Shipment _shipment = new model_Shipment();
                }
            }
            catch (Exception Ex)
            {
                //Show error
                _catchErrorInCondition();
                //Log the Error to the Error Log table
                ErrorLoger.save("wndShipmentScanPage - _saveClick", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId);
            }
        }