Exemple #1
0
        private void RepackPrintLabel_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            TargetViewId = "npRepackLabelParm_DetailView";
            IObjectSpace      objectSpace = Application.CreateObjectSpace();
            npRepackLabelParm lparm       = new npRepackLabelParm();

            RepackLotSerialNo rls = objectSpace.GetObject <RepackLotSerialNo>((RepackLotSerialNo)View.CurrentObject);

            if (rls.LabelType == eLabelType.InnerCarton)
            {
                lparm.LabelFile = rls.RepackLot.RepackItem.BTDefualtTemplate;
            }
            else if (rls.LabelType == eLabelType.Pallet)
            {
                lparm.LabelFile = rls.RepackLot.RepackItem.BTPalletLabelTemplate;
            }
            else //shipping label
            {
                lparm.LabelFile = rls.RepackLot.RepackItem.BTShippingLabelTemplate;
            }
            PrinterSettings printerName = new PrinterSettings();



            lparm.PrinterName = printerName.PrinterName;
            // objectSpace.GetObject<RepackLotSerial>((Vendor)View.CurrentObject);
            // e.View = Application.CreateDetailView(Application.CreateObjectSpace(), lparm);
            e.DialogController.SaveOnAccept = false;
            //  npRepackLabelParm  lparm = objectSpace.CreateObject<npRepackLabelParm>();
            //

            e.View = Application.CreateDetailView(objectSpace, TargetViewId, true, lparm);
            // e.View.Caption = e.View.Caption + " - " + lotSerial.LotId.NDC.ToString();
        }
        private void txtOuterScan_Leave(object sender, System.EventArgs e)
        {
            string scan = txtOuterScan.Text;
            // GS1DataUtil gdu = new GS1DataUtil();
            BarcodeUtil2 gdu = new BarcodeUtil2();

            if (scan.Length != 20)
            {
                string            message = "Scan Length wrong";
                string            caption = "Error Detected in Input";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;
                result            = MessageBox.Show(message, caption, buttons);
                txtOuterScan.Text = string.Empty;
                txtOuterScan.Focus();
                return;
            }

            string pstring;

            pstring      = scan.Substring(2);
            txtSSCC.Text = pstring;
            string s = scan.Substring(2, 1);

            this.txtSerial.Text = s + scan.Substring(10, scan.Length - 11);

            IObjectSpace objectSpace = this.application.CreateObjectSpace();

            CriteriaOperator  op         = CriteriaOperator.Parse("SerialNo = ? ", txtSerial.Text);
            RepackLotSerialNo lsnOutside = objectSpace.FindObject <RepackLotSerialNo>(op);

            if (lsnOutside == null)
            {
                return;
            }
            this.txtLot.Text     = lsnOutside.RepackLot.LotId;
            this.txtExpDt.Text   = lsnOutside.RepackLot.LotExpirationDt.ToString();
            this.TxtContent.Text = lsnOutside.RepackLot.RepackItem.Gtin;
            //gdu.BarcodeDecodeDictionary.TryGetValue("01", out pstring);
            //txtSSCC.Text = pstring;
            //gdu.BarcodeDecodeDictionary.TryGetValue("17", out pstring);
            //txtExpDt.Text = pstring;

            //gdu.BarcodeDecodeDictionary.TryGetValue("10", out pstring);
            //txtLot.Text = pstring;
            //gdu.BarcodeDecodeDictionary.TryGetValue("21", out pstring);
            //txtSerial.Text = pstring;

            txtInnerscan.Focus();
        }
Exemple #3
0
        private void AggEvent_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            // eRFXLImpType impType = eRFXLImpType.QA;

            if (e.SelectedObjects.Count > 0)
            {
                using (IObjectSpace os = Application.CreateObjectSpace())
                {
                    RepackLotSerialNo selectedSerialNo = (RepackLotSerialNo)e.SelectedObjects[0];

                    eSerialTypes stype;

                    stype = eSerialTypes.sequential;
                    stype = selectedSerialNo.RepackLot.RepackItem.SerialType;
                    string strGtin = selectedSerialNo.RepackLot.RepackItem.Gtin;

                    switch (stype)
                    {
                    case eSerialTypes.sequential:

                        throw new NotImplementedException();


                    case eSerialTypes.RFXcel:

                        RFEXCEL rfc = new RFEXCEL(strGtin, 0, Application, impType);
                        rfc.PostAggEvent(e);

                        break;

                    default:

                        break;
                    }
                }
                View.ObjectSpace.Refresh();

                MessageOptions options = new MessageOptions();
                options.Duration     = 20000;
                options.Message      = string.Format("Agg event");
                options.Type         = InformationType.Info;
                options.Web.Position = InformationPosition.Top;
                options.Win.Caption  = "Succeeded";
                options.Win.Type     = WinMessageType.Alert;

                Application.ShowViewStrategy.ShowMessage(options);
            }
            //throw new NotImplementedException();
        }
        private void btnCommission_Click(object sender, System.EventArgs e)
        {
            //       IObjectSpace objectSpace = XafApplication.cre;

            IObjectSpace objectSpace = this.application.CreateObjectSpace();

            //   CriteriaOperator op = CriteriaOperator.Parse("RepackLot.LotId = ? AND SerialNo = ? AND GTIN = ?", txtLot.Text, txtSerial.Text, txtOuterScan.Text);
            CriteriaOperator op = CriteriaOperator.Parse("RepackLot.LotId = ? AND SerialNo = ? ", txtLot.Text, txtSerial.Text);

            RepackLotSerialNo lsnOutside = objectSpace.FindObject <RepackLotSerialNo>(op);

            if (lsnOutside == null)
            {
                return;
            }

            lsnOutside.IsCommission = true;
            lsnOutside.Save();
            objectSpace.CommitChanges();
            // scroll through the list and find the serial number in the system
            //  IObjectSpace objectSpace = Application.ObjectSpaceProvider.CreateObjectSpace()
            //ObjectSpace os = new ObjectSpace(new UnitOfWork(Session.DataLayer), XafTypesInfo.Instance);
            RepackLotSerialNo lsna;

            foreach (var barcode in INBCList)
            {
                op   = CriteriaOperator.Parse("RepackLot.LotId = ? AND SerialNo = ?", barcode.lot, barcode.serial);
                lsna = objectSpace.FindObject <RepackLotSerialNo>(op);
                if (lsna == null)
                {
                    return;
                }
                lsna.ParentSerialNo = txtSerial.Text;
                lsna.IsCommission   = true;
                lsna.Save();
                objectSpace.CommitChanges();
            }

            Clearinfo();
        }
Exemple #5
0
        private void GenSerialNo_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            // eRFXLImpType impType = eRFXLImpType.Production;
            IObjectSpace objectSpace = Application.CreateObjectSpace();
            // IObjectSpace objectSpace = ObjectSpace.CreateNestedObjectSpace();


            RepackLotGenerate lotGenSerial = (RepackLotGenerate)e.PopupWindowView.CurrentObject;
            RepackLots        lsg          = lotGenSerial.LotId;

            RepackLots   RL = (RepackLots)objectSpace.GetObjectByKey(typeof(RepackLots), lsg.Oid);
            eSerialTypes stype;
            int          snumber = 1965;

            if (lsg == null)
            {
                stype = eSerialTypes.sequential;
            }
            stype = RL.RepackItem.SerialType;

            //lsg.RepackItem.SerialType;
            switch (stype)
            {
            case eSerialTypes.sequential:
            {
                int lastSerialNumber = 0;
                lastSerialNumber = RL.LastSerialNumber;
                //Generates Partials
                for (int i = 1; i < lotGenSerial.QtyOfPartial + 1; i++)
                {
                    lastSerialNumber++;
                    string            snum      = lastSerialNumber.ToString().PadLeft(2, '0');
                    RepackLotSerialNo LotSerial = objectSpace.CreateObject <RepackLotSerialNo>();
                    LotSerial.RepackLot = RL;
                    LotSerial.LabelType = eLabelType.InnerCarton;
                    LotSerial.GTIN      = RL.RepackItem.Gtin;
                    LotSerial.isPartial = true;
                    LotSerial.GTIN      = RL.RepackItem.Gtin;
                    LotSerial.SerialNo  = RL.LotId.PadRight(2, '0') + snum;
                    LotSerial.Save();
                }
                //Generates non partials
                for (int i = 1; i < lotGenSerial.QtyToGenerate + 1; i++)
                {
                    lastSerialNumber++;
                    string            snum      = lastSerialNumber.ToString().PadLeft(2, '0');
                    RepackLotSerialNo LotSerial = objectSpace.CreateObject <RepackLotSerialNo>();
                    LotSerial.RepackLot = RL;
                    LotSerial.LabelType = eLabelType.InnerCarton;
                    LotSerial.GTIN      = RL.RepackItem.Gtin;

                    LotSerial.GTIN     = RL.RepackItem.Gtin;
                    LotSerial.SerialNo = RL.LotId.PadRight(2, '0') + snum;
                    LotSerial.Save();
                }


                RL.LastSerialNumber = lastSerialNumber;
                RL.Save();
                break;
            }

            case eSerialTypes.Random:
                Random getRandom = new Random();

                for (int i = 0; i < lotGenSerial.QtyToGenerate; i++)
                {
                    IObjectSpace      objectSpace2 = Application.CreateObjectSpace();
                    RepackLotSerialNo LotSerial    = objectSpace2.CreateObject <RepackLotSerialNo>();
                    LotSerial.RepackLot = RL;
                    LotSerial.LabelType = eLabelType.InnerCarton;
                    LotSerial.GTIN      = RL.RepackItem.Gtin;
                    LotSerial.SerialNo  = lotGenSerial.LotId.ToString() + snumber.ToString("000000") + getRandom.Next(3, 999999).ToString("000000");
                    LotSerial.Save();
                }
                break;

            case eSerialTypes.RFXcel:
                string  gtin = RL.RepackItem.Gtin;
                RFEXCEL rfc  = new RFEXCEL(gtin, lotGenSerial.QtyToGenerate, Application, impType);
                //************************************************
                //
                // Go Get  Serial Number from RXexcel
                //
                //***********************************************
                rfc.PostRequest(gtin, lotGenSerial.QtyToGenerate, e);

                for (int i = 0; i < lotGenSerial.QtyToGenerate; i++)
                {
                    // string is1 = "12345.6789.1111111111";

                    //int lastdot = is1.LastIndexOf(".");
                    //string is2 = is1.Substring(lastdot +1 );
                    RepackLotSerialNo LotSerial = objectSpace.CreateObject <RepackLotSerialNo>();
                    LotSerial.RepackLot = RL;
                    LotSerial.LabelType = eLabelType.InnerCarton;
                    LotSerial.SerialNo  = rfc.SerialList[i];
                    LotSerial.sGTIN     = rfc.sGTIN[i];
                    LotSerial.GTIN      = RL.RepackItem.Gtin;


                    //LotSerial.SerialNo = RL.LotId.ToString() + snumber.ToString("000000") + i + 1.ToString("000000");
                    LotSerial.Save();
                }
                break;
            }
            objectSpace.CommitChanges();
            ObjectSpace.Refresh();
            MessageOptions options = new MessageOptions();

            options.Duration     = 20000;
            options.Message      = string.Format("{0} Serial Number for Lot {1} has been entered", lotGenSerial.QtyToGenerate, lotGenSerial.LotId.LotId.ToString());
            options.Type         = InformationType.Success;
            options.Web.Position = InformationPosition.Right;
            options.Win.Caption  = "Success";
            options.Win.Type     = WinMessageType.Alert;
            //options.OkDelegate = () => {
            //    IObjectSpace os = Application.CreateObjectSpace(typeof(Customer));
            // DetailView newTaskDetailView = Application.CreateDetailView(os, os.CreateObject<ItemRequest>());
            // Application.ShowViewStrategy.ShowViewInPopupWindow(newTaskDetailView);
            //};
            Application.ShowViewStrategy.ShowMessage(options);
        }