Пример #1
0
        private int AddToSerialNumber(string itemnumber, string lot, string serialnumber, string expdate, string scan)
        {
            IObjectSpace objectspace = this.ObjectSpace.CreateNestedObjectSpace();

            // InventoryItemBatchItems iiBi = this.ObjectSpace.GetObject<InventoryItemBatchItems>();

            ItemInventoryBatch iib = objectToShow;

            // Find the item in the item list
            // bool found = false;
            Session session;

            session = objectToShow.Session;
            CriteriaOperator op = GroupOperator.Combine(GroupOperatorType.And,
                                                        new BinaryOperator("ItemInventoryBatch", iib.Oid),
                                                        new BinaryOperator("NDC", itemnumber),
                                                        new BinaryOperator("Lot", lot),
                                                        new BinaryOperator("SerialNumber", serialnumber));

            ItemInventoryBatchSerialNo itemToUpdate = (ItemInventoryBatchSerialNo)session.FindObject(typeof(ItemInventoryBatchSerialNo),
                                                                                                     op, true);


            if (itemToUpdate != null)
            {
                return(-1);
            }
            else
            {
                ItemInventoryBatchSerialNo iibi;

                iibi = objectspace.CreateObject <ItemInventoryBatchSerialNo>();


                iibi.ItemInventoryBatch = objectspace.GetObject <ItemInventoryBatch>((ItemInventoryBatch)this.View.CurrentObject);


                iibi.NDC          = itemnumber;
                iibi.Lot          = lot;
                iibi.Barcode      = scan;
                iibi.SerialNumber = serialnumber;
                DateTime result;
                if (DateTime.TryParse(expdate, out result))
                {
                    iibi.ExpDate = result;
                }
                iibi.Save();
                objectspace.CommitChanges();
                //  objectspace.Refresh();
            }
            objectToShow.Item.Reload();
            //jectSpace.ReloadObject();

            this.View.ObjectSpace.CommitChanges();
            this.View.ObjectSpace.Refresh();


            return(1);
        }
Пример #2
0
        private void InventoryItemBatchScan_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            ItemInventoryBatch IIB = (ItemInventoryBatch)e.CurrentObject;
            // Guid iOID = IIB.Oid;
            InventoryItemScanForm form = new InventoryItemScanForm(IIB);

            form.ShowDialog();
        }
Пример #3
0
        private void AddToItemSerial(ItemInventoryBatch itemInventoryBatch, string e)
        {
            IObjectSpace objectSpace = View.ObjectSpace.CreateNestedObjectSpace();
            ItemInventoryBatchSerialNo itemSerials = objectSpace.CreateObject <ItemInventoryBatchSerialNo>();

            itemSerials.ItemInventoryBatch = itemInventoryBatch;
            itemSerials.NDC          = "123456";
            itemSerials.SerialNumber = "ssn123456";
            itemSerials.Lot          = "lot123";
            itemSerials.ExpDate      = DateTime.Now;
        }
Пример #4
0
        public InventoryItemScanForm(ItemInventoryBatch iib)

        {
            IIB = iib;

            InitializeComponent();
            this.Text = "Item Scans for: " + IIB.BatchDiscription;


            DXGridSerialNoList.DataSource = new XPCollection <ItemInventoryBatchSerialNo>(iib.Session);
            DXGridSerialNoList.DataSource = SampleDS();
        }
Пример #5
0
        private void IIB_LastScanChangedEvent(object sender, string e)
        {
            ItemInventoryBatch iib = (ItemInventoryBatch)sender;

            if (e == string.Empty)
            {
                return;
            }

            scancount++;
            string         scan = e;
            PropertyEditor editor;
            BarcodeUtil2   gdu = new BarcodeUtil2();

            if (scan.Length < 30)
            {
                string message = "You did not scan a GS1 2d barcode.";
                //string caption = "Error Detected in Input";
                // MessageBoxButtons buttons = MessageBoxButtons.OK;
                //DialogResult result;
                Application.ShowViewStrategy.ShowMessage(message);

                editor = ((DetailView)View).FindItem("LastScan") as PropertyEditor;
                if (editor != null)
                {
                    (editor.Control as Control).Focus();
                }


                return;
            }
            if (iib.Oid == -1)
            {
                iib.Save();
            }



            AddToItem(iib, e);
            AddToItemSerial(iib, e);

            // now set the focus back to LastScan and empty out values
            editor = ((DetailView)View).FindItem("LastScan") as PropertyEditor;
            if (editor != null)
            {
                IIB.LastScan = string.Empty;


                (editor.Control as Control).Focus();
            }
        }
Пример #6
0
        private void AddToItem(ItemInventoryBatch itemInventoryBatch, string e)
        {
            IObjectSpace            objectSpace = View.ObjectSpace.CreateNestedObjectSpace();
            InventoryItemBatchItems items       = objectSpace.CreateObject <InventoryItemBatchItems>( );

            items.InventoryBatch = itemInventoryBatch;

            items.NDC            = "123456";
            items.Qty            = 1;
            items.Lot            = "lot123";
            items.ExpirationDate = DateTime.Now;
            items.Save();

            objectSpace.CommitChanges();
        }
Пример #7
0
        private void ShInventoryController_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            ;
            TargetViewId = "ItemInventoryBatch_DetailView";
            IObjectSpace objectSpace = Application.CreateObjectSpace();

            IIB = objectSpace.CreateObject <ItemInventoryBatch>();
            // subscribe to the LastScanChanged event to capture the scans
            IIB.LastScanChangedEvent += IIB_LastScanChangedEvent;

            //objectSpace.ObjectEndEdit
            IIB.CreatedDate   = DateTime.Now;
            IIB.InventoryType = eInventoryBatchType.Partial;
            IIB.CreatedBy     = SecuritySystem.CurrentUserName;
            e.View            = Application.CreateDetailView(objectSpace, TargetViewId, true, IIB);
            e.View.Caption    = e.View.Caption + " - " + IIB?.Oid.ToString();
            IIB.Save();
        }
Пример #8
0
        private void EditInventoryItemBatchAction_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            // IObjectSpace newObjectSpace = e.View.ObjectSpace;
            // IObjectSpace newObjectSpace = Application.CreateObjectSpace();
            IObjectSpace newObjectSpace = Application.CreateObjectSpace(View.ObjectTypeInfo.Type);

            objectToShow = (ItemInventoryBatch)newObjectSpace.GetObject(View.CurrentObject);
            //objectToShow = newObjectSpace.GetObject(View.CurrentObject);
            if (objectToShow != null)
            {
                IIB         = (ItemInventoryBatch)View.CurrentObject;
                createdView = Application.CreateDetailView(newObjectSpace, IIB);
                createdView.ViewEditMode = ViewEditMode.Edit;
                e.View       = createdView;
                IIB.LastScan = "";
                E            = e;
                //   IIB.LastScanChangedEvent += IIB_LastScanChangedEvent;
            }
        }
Пример #9
0
        private void EditInventoryItemBatchPopup_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            TargetViewId = "ItemInventoryBatch_DetailView";
            {
                IObjectSpace newObjectSpace = Application.CreateObjectSpace(View.ObjectTypeInfo.Type);
                objectToShow = (ItemInventoryBatch)newObjectSpace.GetObject(View.CurrentObject);

                if (objectToShow != null)
                {
                    createdView = Application.CreateDetailView(newObjectSpace, objectToShow);
                    createdView.ViewEditMode = ViewEditMode.Edit;

                    e.View = createdView;


                    objectToShow.LastScanChangedEvent += ObjectToShow_LastScanChangedEvent;
                }
            }
        }
Пример #10
0
        private int AddToItems(object sender, string itemnumber, string lot, string expdate, string scan)
        {
            // this counts for non serialized numbers


            // editor1 = ((DetailView)View).FindItem("Items") as ListPropertyEditor;
            IObjectSpace objectspace = this.ObjectSpace.CreateNestedObjectSpace();

            // InventoryItemBatchItems iiBi = this.ObjectSpace.GetObject<InventoryItemBatchItems>();

            ItemInventoryBatch iib = objectToShow;

            // Find the item in the item list
            // bool found = false;
            Session session;

            session = objectToShow.Session;
            CriteriaOperator op = GroupOperator.Combine(GroupOperatorType.And,
                                                        new BinaryOperator("InventoryBatch", iib.Oid),
                                                        new BinaryOperator("NDC", itemnumber),
                                                        new BinaryOperator("Lot", lot));

            InventoryItemBatchItems itemToUpdate = (InventoryItemBatchItems)session.FindObject(typeof(InventoryItemBatchItems),
                                                                                               op, true);


            if (itemToUpdate != null)
            {
                itemToUpdate.Qty++;
                itemToUpdate.Save();
                session.CommitTransaction();
            }
            else
            {
                InventoryItemBatchItems iibi;

                iibi = objectspace.CreateObject <InventoryItemBatchItems>();


                iibi.InventoryBatch = objectspace.GetObject <ItemInventoryBatch>((ItemInventoryBatch)this.View.CurrentObject);
                //iibi.InventoryBatch.Oid = iib.Oid;

                iibi.NDC = itemnumber;
                iibi.Lot = lot;
                iibi.Qty = 1;
                DateTime result;
                if (DateTime.TryParse(expdate, out result))
                {
                    iibi.ExpirationDate = result;
                }
                iibi.Save();
                objectspace.CommitChanges();
                // objectspace.Refresh();
            }

            objectToShow.Save();
            this.View.ObjectSpace.CommitChanges();
            objectToShow.ItemInventoryBatchS.Reload();
            objectToShow.Item.Reload();
            //jectSpace.ReloadObject();

            this.View.ObjectSpace.Refresh();
            return(1);
        }