Ejemplo n.º 1
0
        public static CashIn convertToCashIn(WFSCIMCASHIN item)
        {
            CashIn unit = new CashIn();

            unit.usNumber         = item.usNumber;
            unit.fwType           = item.fwType;
            unit.cUnitID          = item.cUnitID;
            unit.cCurrencyID      = item.cCurrencyID;
            unit.ulValues         = item.ulValues;
            unit.ulCashInCount    = item.ulCashInCount;
            unit.ulCount          = item.ulCount;
            unit.ulMaximum        = item.ulMaximum;
            unit.usStatus         = item.usStatus;
            unit.bAppLock         = item.bAppLock;
            unit.usNumPhysicalCUs = item.usNumPhysicalCUs;

            if (item.usNumPhysicalCUs > 0)
            {
                unit.lppPhysical = XFSUtil.XFSPtrToArray <WFSCIMPHCU>(item.lppPhysical, item.usNumPhysicalCUs);
            }
            else
            {
                unit.lppPhysical = new WFSCIMPHCU[0];
            }

            var notnumberList = new WFSCIMNOTENUMBERLIST();

            XFSUtil.PtrToStructure <WFSCIMNOTENUMBERLIST>(item.lpNoteNumberList, ref notnumberList);
            unit.lpNoteNumberList = convertToNoteNumberList(notnumberList);

            unit.lpszExtra = item.lpszExtra;

            return(unit);
        }
Ejemplo n.º 2
0
        public void Fill(object result)
        {
            var data = (WFSCIMSTATUS)result;

            this.fwDevice = data.fwDevice;
            this.fwIntermediateStacker = data.fwIntermediateStacker;
            this.fwSafeDoor            = data.fwSafeDoor;
            this.lpszExtra             = data.lpszExtra;
            this.fwAcceptor            = data.fwAcceptor;
            this.fwStackerItems        = data.fwStackerItems;
            this.fwBanknoteReader      = data.fwBanknoteReader;
            this.bDropBox = data.bDropBox;

            var tmp = Activator.CreateInstance(typeof(WFSCIMOUTPOS));

            XFSUtil.PtrToStructure(data.lppPositions, typeof(WFSCIMOUTPOS), ref tmp);

            try
            {
                this.lppPositions = new WFSCIMOUTPOS
                {
                    fwPosition        = ((WFSCIMOUTPOS)tmp).fwPosition,
                    fwPositionStatus  = ((WFSCIMOUTPOS)tmp).fwPositionStatus,
                    fwShutter         = ((WFSCIMOUTPOS)tmp).fwShutter,
                    fwTransport       = ((WFSCIMOUTPOS)tmp).fwTransport,
                    fwTransportStatus = ((WFSCIMOUTPOS)tmp).fwTransportStatus
                };
            }
            catch (Exception ex)
            {
                L4Logger.Error(ex);
                L4Logger.Info(string.Format("Device Result => {0}  And PositionXfs {1} )", Newtonsoft.Json.JsonConvert.SerializeObject(tmp), data.lppPositions));
                this.lppPositions = new WFSCIMOUTPOS();
            }
        }
Ejemplo n.º 3
0
        public void Fill(object result)
        {
            var data = (WFS_CDM_STATUS)result;

            this.dwGuidLights            = data.dwGuidLights;
            this.fwDevice                = data.fwDevice;
            this.fwDispenser             = data.fwDispenser;
            this.fwIntermediateStacker   = data.fwIntermediateStacker;
            this.fwSafeDoor              = data.fwSafeDoor;
            this.lpszExtra               = data.lpszExtra;
            this.usPowerSaveRecoveryTime = data.usPowerSaveRecoveryTime;
            this.wDevicePosition         = data.wDevicePosition;
            var tmp = Activator.CreateInstance(typeof(WFS_CDM_OUTPOS));

            XFSUtil.PtrToStructure(data.lppPositions, typeof(WFS_CDM_OUTPOS), ref tmp);

            try
            {
                this.lppPositions = new WFS_CDM_OUTPOS
                {
                    fwPosition        = ((WFS_CDM_OUTPOS)tmp).fwPosition,
                    fwPositionStatus  = ((WFS_CDM_OUTPOS)tmp).fwPositionStatus,
                    fwShutter         = ((WFS_CDM_OUTPOS)tmp).fwShutter,
                    fwTransport       = ((WFS_CDM_OUTPOS)tmp).fwTransport,
                    fwTransportStatus = ((WFS_CDM_OUTPOS)tmp).fwTransportStatus
                };
            }
            catch (Exception ex)
            {
                L4Logger.Error(ex);
                L4Logger.Info(string.Format("Device Result => {0}  And PositionXfs {1} )", Newtonsoft.Json.JsonConvert.SerializeObject(tmp), data.lppPositions));
                this.lppPositions = new WFS_CDM_OUTPOS();
            }
        }
Ejemplo n.º 4
0
 protected override void OnExecuteEvent(ref WFSRESULT result)
 {
     switch (result.dwCommandCodeOrEventID)
     {
     case PINDefinition.WFS_EXEE_PIN_KEY:
         WFSPINKEY key = new XFSNet.PIN.WFSPINKEY();
         XFSUtil.PtrToStructure(result.lpBuffer, ref key);
         OnPINKey(ref key);
         break;
     }
 }
Ejemplo n.º 5
0
        public void Fill(object result)
        {
            var            data = (WFSBCRREADOUTPUT)result;
            WFSBCRPHEXDATA tmp  = new WFSBCRPHEXDATA();

            XFSUtil.PtrToStructure <WFSBCRPHEXDATA>(data.lpxBarcodeData, ref tmp);

            try
            {
                if (tmp.lpbData != null)
                {
                    this.Value = XFSUtil.GetSeratedStringFromPointer(tmp.lpbData)[0];
                }
            }
            catch { this.Value = string.Empty; }
        }
Ejemplo n.º 6
0
        public ISTATUS UnMarshal(IntPtr pointer)
        {
            var cashinfoObj = new CimCashInfoObject();

            var cashunitInfo = new WFSCIMCASHINFO();

            XFSUtil.PtrToStructure <WFSCIMCASHINFO>(pointer, ref cashunitInfo);
            cashinfoObj.usCount = cashunitInfo.usCount;

            var cashUnits = XFSUtil.XFSPtrToArray <WFSCIMCASHIN>(cashunitInfo.lppCashIn, cashunitInfo.usCount);

            cashinfoObj.CashIns = new CashIn[cashUnits.Length];
            for (int i = 0; i < cashUnits.Length; i++)
            {
                cashinfoObj.CashIns[i] = CashIn.convertToCashIn(cashUnits[i]);
            }

            return(cashinfoObj);
        }
Ejemplo n.º 7
0
        public ISTATUS UnMarshal(IntPtr pointer)
        {
            var cashinfoObj = new CashInfoObject();

            var cashunitInfo = new WFS_CDM_CashUnit_INFO();

            XFSUtil.PtrToStructure <WFS_CDM_CashUnit_INFO>(pointer, ref cashunitInfo);

            cashinfoObj.TellerID = cashunitInfo.usTellerID;
            cashinfoObj.usCount  = cashunitInfo.usCount;

            var cashUnits = XFSUtil.XFSPtrToArray <WFSCDMCASHUNIT>(cashunitInfo.lppList, cashunitInfo.usCount);

            cashinfoObj.CashUnits = new CashUnit[cashUnits.Length];

            for (int i = 0; i < cashUnits.Length; i++)
            {
                cashinfoObj.CashUnits[i] = CashUnit.convertToCashUnit(cashUnits[i]);
            }

            return(cashinfoObj);
        }
Ejemplo n.º 8
0
        private void XFSDevice_ExecuteComplete(ServiceTypes serviceType, IntPtr obj, int EventID)
        {
            try
            {
                lock (syncObject)
                {
                    if (obj == IntPtr.Zero)
                    {
                        XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.IsExecuteSuccessfully = true;
                        XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.Detail = "XFSDevice_ExecuteComplete";

                        var XfsCommand = (XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.XfsCommand as ExecuteCommand);
                        if (XfsCommand != null && XfsCommand.LightControlCommand != null)
                        {
                            ExcuteSiuCommand(XfsCommand.LightControlCommand.CompleteSIU, serviceType);
                        }
                        SendResponse(XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand);
                        return;
                    }
                    else
                    {
                        XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.IsExecuteSuccessfully = true;
                        #region old
                        //switch (EventID)
                        //{
                        //    case IDCDefinition.WFS_CMD_IDC_READ_RAW_DATA:
                        //        {
                        //            //(CurrentCommand.XfsCommand as ExecuteCommand).Result = Activator.CreateInstance((CurrentCommand.XfsCommand as ExecuteCommand).ResultType);
                        //            var resobj = OnReadRawDataComplete(obj);
                        //            if(resobj.Length==0)
                        //            {
                        //                XFSDevice_ExecuteError(serviceType, "", -500, "-500");
                        //                return;
                        //            }
                        //            (XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.XfsCommand as ExecuteCommand).ResultModel = resobj;
                        //            break;
                        //        }
                        //    default:
                        //        {

                        //            break;
                        //        }
                        //}
                        #endregion

                        XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.Detail = "XFSDevice_ExecuteComplete";

                        var XfsCommand = (XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.XfsCommand as ExecuteCommand);

                        if ((XfsCommand.ResultXfs.GetType().Name.Equals("JArray")))
                        {
                            int len   = 0;
                            var data  = XFSUtil.XFSPtrToArray(obj, XfsCommand.ResultXfsType, ref len);
                            var model = Array.CreateInstance(XfsCommand.ResultModelType, len);
                            for (int i = 0; i < len; ++i)
                            {
                                var tmp = (IXfsResultModel)Activator.CreateInstance(XfsCommand.ResultModelType);
                                tmp.Fill(data.GetValue(i));
                                model.SetValue(tmp, i);
                            }
                            XfsCommand.ResultModel = model;
                        }
                        else
                        {
                            object data = null;
                            XFSUtil.PtrToStructure(obj, XfsCommand.ResultXfsType, ref data);
                            var model = (IXfsResultModel)Activator.CreateInstance(XfsCommand.ResultModelType);
                            model.Fill(data);
                            XfsCommand.ResultModel = model;
                        }

                        if (XfsCommand != null && XfsCommand.LightControlCommand != null)
                        {
                            ExcuteSiuCommand(XfsCommand.LightControlCommand.CompleteSIU, serviceType);
                        }

                        SendResponse(XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand);
                    }
                }
            }
            catch (Exception ex)
            {
                L4Logger.Error(ex);
            }
        }
Ejemplo n.º 9
0
        private void XFSDevice_ExecuteEvent(ServiceTypes serviceType, int EventID, IntPtr obj)
        {
            L4Logger.Info("XFSDevice_ExecuteEvent");
            lock (syncObject)
            {
                try
                {
                    var math = XFS_DevicesCollection.Instance.GetValue(serviceType).GlobalEvents.FirstOrDefault(c => c.EventId == EventID);
                    if (math != null)
                    {
                        L4Logger.Info("Global Event Reaised");
                        object res = null;
                        res = Activator.CreateInstance(math.EventParamType);
                        XFSUtil.PtrToStructure(obj, math.EventParamType, ref res);
                        ExecuteEventBase eventBase = new ExecuteEventBase
                        {
                            EventID        = EventID,
                            EventParam     = res,
                            EventParamType = math.EventParamType
                        };
                        SendResponse(eventBase);
                    }
                    else if (XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.XfsCommand is ExecuteCommand)
                    {
                        L4Logger.Info("Command Event Reaised");
                        var    cmnd = (XFS_DevicesCollection.Instance.GetValue(serviceType).CurrentCommand.XfsCommand as ExecuteCommand);
                        object res  = null;
                        if (cmnd != null && cmnd.EventParamType != null)
                        {
                            L4Logger.Info("Event hass response model");
                            res = Activator.CreateInstance(cmnd.EventParamType);
                            XFSUtil.PtrToStructure(obj, cmnd.EventParamType, ref res);

                            ExecuteEventBase eventBase = new ExecuteEventBase
                            {
                                EventID        = EventID,
                                EventParam     = res,
                                EventParamType = cmnd.EventParamType
                            };
                            SendResponse(eventBase);
                        }
                        else if (cmnd.EventParamType == null)
                        {
                            L4Logger.Info("Event not model");
                            ExecuteEventBase eventBase = new ExecuteEventBase
                            {
                                EventID        = EventID,
                                EventParam     = null,
                                EventParamType = null
                            };
                            SendResponse(eventBase);
                        }
                    }
                    else
                    {
                        L4Logger.Info("Un categoriezd Event");
                        ExecuteEventBase eventBase = new ExecuteEventBase
                        {
                            EventID        = EventID,
                            EventParam     = null,
                            EventParamType = null
                        };
                        SendResponse(eventBase);
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }