Esempio n. 1
0
        private void AssignInitialValue(ManifestModel manifestModel)
        {
            try
            {
                NewBatchModel            = manifestModel?.NewBatches.FirstOrDefault();
                SizeButtonTitle          = manifestModel?.Size;
                DestinationTitle         = manifestModel?.OwnerName;
                ManifestId               = manifestModel?.ManifestId;
                ConstantManager.Barcodes = manifestModel?.BarcodeModels;

                try
                {
                    PartnerModel partner = new PartnerModel()
                    {
                        PartnerId = manifestModel?.ReceiverId,
                        FullName  = manifestModel?.OwnerName
                    };
                    ConstantManager.Partner = partner;
                    if (manifestModel.Tags != null)
                    {
                        ConstantManager.Tags = new List <Tag>();
                        foreach (var item in manifestModel.Tags)
                        {
                            ConstantManager.Tags.Add(item);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                }

                foreach (var item in manifestModel.NewPallets)
                {
                    PalletModel palletModel = new PalletModel
                    {
                        Count      = item.PalletItems.Count,
                        ManifestId = ManifestId,
                        BatchId    = item.PalletId
                    };
                    palletModel.Barcode = ConstantManager.Barcodes;
                    if (PalletCollection == null)
                    {
                        PalletCollection = new List <PalletModel>();
                    }
                    PalletCollection.Add(palletModel);
                    IsPalletze = item.IsPalletze;
                }
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
        }
 private async Task ItemTappedCommandRecieverAsync(PalletModel model)
 {
     try
     {
         await _navigationService.NavigateAsync("FillScanView", new NavigationParameters
         {
             { "model", model }
         }, animated : false);
     }
     catch (Exception ex)
     {
         Crashes.TrackError(ex);
     }
 }
Esempio n. 3
0
        protected override void OnLoad(EventArgs e)
        {
            //初始化标签打印模块
            string config = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\label.xml";

            if (!LabelPrintGlobal.g_LabelCreator.LoadConfig(config))
            {
                MessageBox.Show(LabelPrintGlobal.ShowWarningMessage("LABEL_PRINT_INIT_ERROR"), "ERROR", MessageBoxButtons.OK);
                Close();
                return;
            }

            //基础配置文件
            LabelPrintGlobal.g_ConfigFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\config.xml";
            TPCResult <bool> rt = LabelPrintGlobal.g_Config.LoadConfig(LabelPrintGlobal.g_ConfigFile);

            if (rt.State == RESULT_STATE.NG)
            {
                MessageBox.Show(rt.Message);
                Close();
                return;
            }

            ///初始化三种模式
            #region 初始化三种模式
            m_Pack   = new PackModel(m_PackingForm);
            m_Carton = new CartonModel(m_PackingForm);
            m_Pallet = new PalletModel(m_PackingForm);

            m_Pack.Database   = m_DatabseHelper;
            m_Carton.Database = m_DatabseHelper;
            m_Pallet.Database = m_DatabseHelper;

            m_Pack.CodeKey   = "BM004HK1-1";
            m_Carton.CodeKey = "BM004HK1-1";
            m_Pallet.CodeKey = "BM004HK1-1";
            #endregion

            m_PackingForm.Model = m_Pack;

            m_PackingForm.Show();
            InitLanguage();
            InitAuth();

            ShowMode(PACK_MODE.Pack);
        }
        public void GenerateManifestIdAsync(PalletModel palletModel)
        {
            try
            {
                DateTimeOffset now = DateTimeOffset.Now;
                string barCode;
                long prefix = 0;
                var lastCharOfYear = now.Year.ToString().ToCharArray().LastOrDefault().ToString();
                var dayOfYear = now.DayOfYear;
                var secondsInDayTillNow = SecondsInDayTillNow();
                var millisecond = now.Millisecond;

                if (IsPalletze)
                {
                    if (palletModel != null)
                    {
                        BatchId = palletModel.BatchId;
                        Title = "Pallet #" + BatchId;
                        foreach (var item in palletModel.Barcode)
                        {
                            BarcodeCollection.Add(item);
                            TagsStr = item.TagsStr ?? string.Empty;
                        }
                    }
                    else
                    {
                        BarcodeCollection.Clear();

                        barCode = GenerateBatchId(ref prefix, lastCharOfYear, dayOfYear, secondsInDayTillNow, millisecond);
                    }
                }
                else
                {
                    barCode = GenerateBatchId(ref prefix, lastCharOfYear, dayOfYear, secondsInDayTillNow, millisecond);
                }
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
        }
 internal void AssignFillScanValue(IList <BarcodeModel> _barcodes, string _batchId)
 {
     try
     {
         PalletModel pallet = PalletCollection.Where(x => x.BatchId == _batchId).FirstOrDefault();
         if (pallet != null)
         {
             using (var db = Realm.GetInstance(RealmDbManager.GetRealmDbConfig()).BeginWrite())
             {
                 pallet.Barcode = _barcodes;
                 pallet.Count   = _barcodes.Count();
                 db.Commit();
             }
         }
         else
         {
             PalletCollection.Add(new PalletModel()
             {
                 Barcode = _barcodes,
                 Count   = _barcodes.Count(),
                 BatchId = _batchId,
             });
         }
         if (PalletCollection.Sum(x => x.Count) > 1)
         {
             Kegs = string.Format("({0} Kegs)", PalletCollection.Sum(x => x.Count));
         }
         else
         {
             Kegs = string.Format("({0} Keg)", PalletCollection.Sum(x => x.Count));
         }
     }
     catch (Exception ex)
     {
         Crashes.TrackError(ex);
     }
 }
        public void GenerateManifestIdAsync(PalletModel palletModel)
        {
            var            RealmDb = Realm.GetInstance(RealmDbManager.GetRealmDbConfig());
            DateTimeOffset now     = DateTimeOffset.Now;
            string         barCode;
            long           prefix              = 0;
            var            lastCharOfYear      = now.Year.ToString().ToCharArray().LastOrDefault().ToString();
            var            dayOfYear           = now.DayOfYear;
            var            secondsInDayTillNow = SecondsInDayTillNow();
            var            millisecond         = now.Millisecond;

            var preference = RealmDb.All <Preference>().Where(x => x.PreferenceName == "DashboardPreferences").ToList();

            try
            {
                foreach (var item in preference)
                {
                    if (item.PreferenceValue.Contains("OldestKegs"))
                    {
                        var preferenceValue = JsonConvert.DeserializeObject <PreferenceValueResponseModel>(item.PreferenceValue);
                        var value           = preferenceValue.SelectedWidgets.Where(x => x.Id == "OldestKegs").FirstOrDefault();
                        prefix = value.Pos.Y;
                    }
                }
                barCode = prefix.ToString().PadLeft(9, '0') + lastCharOfYear + dayOfYear + secondsInDayTillNow + (millisecond / 100);
                var checksumDigit = _calcCheckDigitMngr.CalculateCheckDigit(barCode);
                ManifestId = barCode + checksumDigit;
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
            finally
            {
                preference = null;
            }
        }
 public IActionResult ReciveEditPallet(PalletModel value)
 {
     //add model to db.
     return(Json(value));
 }
 private void DeleteItemCommandReciever(PalletModel model)
 {
     PalletCollection.Remove(model);
     CountKegs();
 }