Exemple #1
0
        public PrintDataMessage GenSingleTrayLabel(string trayId, string dateFormat, string[] keepers)
        {
            PrintDataMessage    pdm = new PrintDataMessage();
            ValidateMsg <Trays> msg = TraysHelper.TrayCanPrint(trayId);

            if (msg.Valid)
            {
                List <TrayPackView> tpv = TrayPackViewHelper.GetTPVByTrayIdsGropSumPartNr(new List <string>()
                {
                    trayId
                });
                string[]         dateFormats = dateFormat.Split(',');
                List <PrintTask> tasks       = new List <PrintTask>();
                foreach (string keeper in keepers)
                {
                    RecordSet rs   = new RecordSet();
                    PrintTask task = new PrintTask()
                    {
                        DataSet = rs
                    };
                    foreach (TrayPackView t in tpv)
                    {
                        RecordData label = new RecordData();
                        label.Add("TrayId", t.trayId);
                        label.Add("Warehouse", t.warehouse);
                        label.Add("Position", t.position);
                        label.Add("customerPNr", t.customerPartNr);
                        label.Add("PartNr", t.partNr);
                        label.Add("Capa", t.capa.ToString());
                        label.Add("Keeper", keeper);
                        label.Add("CreateTime", t.createTime.ToString(dateFormats[0]));
                        label.Add("StoreCreateTime", t.createTime.ToString(dateFormats[1]));
                        rs.Add(label);
                    }
                    tasks.Add(task);
                }
                pdm.PrintTask      = tasks;
                pdm.ReturnedResult = true;
            }
            else
            {
                pdm.ReturnedResult = false;
                pdm.ReturnedMessage.Add(msg.ToString());
            }
            return(pdm);
        }
 private void validateTBPackageID()
 {
     if (TBPackageId.Text.Length > 0)
     {
         ValidateMsg <SinglePackage> msg = packageStoreService.SingleCheckStore(TBPackageId.Text);
         if (!msg.Valid)
         {
             new InfoBoard(MsgLevel.Mistake, msg.ToString()).ShowDialog();
         }
         else
         {
             bool scand = false;
             if (DGTrayItemsDetail.ItemsSource != null)
             {
                 foreach (var i in DGTrayItemsDetail.ItemsSource)
                 {
                     if ((i as SinglePackage).packageID.Equals(msg.Target.packageID))
                     {
                         new InfoBoard(MsgLevel.Mistake, TBPackageId.Text + " 已经扫入!").ShowDialog();
                         scand = true;
                         break;
                     }
                 }
             }
             if (!scand)
             {
                 if (SPDataSource == null)
                 {
                     SPDataSource = new List <SinglePackage>();
                 }
                 SPDataSource.Insert(0, msg.Target);
                 DGTrayItemsDetail.ItemsSource = null;
                 DGTrayItemsDetail.ItemsSource = SPDataSource;
                 LabPackNum.Content            = SPDataSource.Count;
                 //  BtnNew.IsEnabled = false;
                 BtnFinsh.IsEnabled = true;
             }
         }
         TBPackageId.Text = string.Empty;
     }
 }