Example #1
0
        private int isOK = 0;                                          //收发货标识
        #endregion

        #region 创建Activity
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here

            SetContentView(Resource.Layout.InsideDish);

            //操作人
            UserName      = Intent.GetStringExtra("username");
            username      = FindViewById <EditText>(Resource.Id.username);
            username.Text = UserName;

            btGet         = FindViewById <ToggleButton>(Resource.Id.btGet);
            btGet.Enabled = false;
            btGet.Click  += getDb;

            btSender         = FindViewById <ToggleButton>(Resource.Id.btSet);
            btSender.Enabled = false;
            btSender.Click  += sendDb;

            btSave         = FindViewById <ToggleButton>(Resource.Id.btSave);
            btSave.Enabled = true;
            btSave.Checked = true;
            btSave.Click  += dbSave;


            if (CommonFunction.mode == "NFC")
            {
                #region NFC 模式
                try
                {
                    m_nfcAdapter = NfcAdapter.GetDefaultAdapter(this);
                    if (m_nfcAdapter == null)
                    {
                        CommonFunction.ShowMessage("设备不支持NFC!", this, true);
                        return;
                    }
                    if (!m_nfcAdapter.IsEnabled)
                    {
                        CommonFunction.ShowMessage("请在系统设置中先启用NFC功能!", this, true);
                        return;
                    }

                    //m_nfcAdapter.SetNdefPushMessage(CreateNdefMessageCallback(), this, this);

                    mTechLists = new string[][] { new string[] { "Android.Nfc.Tech.MifareClassic" }, new string[] { "Android.Nfc.Tech.NfcA" } };
                    IntentFilter tech = new IntentFilter(NfcAdapter.ActionTechDiscovered);
                    mFilters = new IntentFilter[] { tech, };                                                                                                                       //存放支持technologies的数组

                    mPendingIntent = PendingIntent.GetActivity(this, 0, new Intent(this, typeof(InsideDish)).AddFlags(ActivityFlags.SingleTop), PendingIntentFlags.UpdateCurrent); //intent过滤器,过滤类型为NDEF_DISCOVERED


                    //Mifare卡和Desfare卡都是ISO - 14443 - A卡
                    ProcessAdapterAction(this.Intent);
                }
                catch (Exception ex)
                {
                    CommonFunction.ShowMessage(ex.Message, this, true);
                }

                #endregion
            }
            else if (CommonFunction.mode == "SerialPort")
            {
                #region SerialPort模式
                try
                {
                    Stream im;
                    Stream om;
                    serial = new SerialPort(13, 115200, 0);
                    serial.Power_5Von();

                    im = serial.MFileInputStream;
                    om = serial.MFileOutputStream;

                    hf = new HfReader(im, om);
                }
                catch (Exception ex)
                {
                    CommonFunction.ShowMessage(ex.Message, this, true);
                }
                #endregion
            }
        }
Example #2
0
        public string seqId;//取样编号


        #endregion

        #region  创建Activity
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.YugaSamp);

            username = Intent.GetStringExtra("username");

            //厂家
            samp_factory      = FindViewById <EditText>(Resource.Id.sampFactory);
            samp_factory.Text = "豫港";

            //数据库查询地点
            //bsif.selectAdress( out bsif.sampAdress, out bsif.adressCode);
            samp_adress      = FindViewById <EditText>(Resource.Id.sampAdress);
            samp_adress.Text = "豫港焦炭皮带称";

            adressID   = 11;
            adressCode = "11";

            //货物名称
            samp_goodsname      = FindViewById <EditText>(Resource.Id.sampGoodsname);
            cNCGoodsCode        = "0700000602";
            samp_goodsname.Text = "焦炭";

            //业务类型
            //业务类型下拉菜单
            sp_mode = FindViewById <Spinner>(Resource.Id.sampMode);
            sp_mode.ItemSelected += selectMode_ItemSelected;

            //数据库查询 暂不用
            //bsif.sampModeNameList = bsif.selectSampMode();

            //填充xml数据
            ArrayAdapter adapter_mode = ArrayAdapter.CreateFromResource(this, Resource.Array.SampMode, Android.Resource.Layout.SimpleSpinnerItem);

            adapter_mode.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            sp_mode.Adapter = adapter_mode;
            sp_mode.Prompt  = "请选择";

            ////填充数据 数据库数据
            //ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, bsif.sampModeNameList);
            //adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            //sp_mode.Adapter = adapter;

            //日期
            string tmnw = System.DateTime.Now.ToString("yyyy-MM-dd HH:ss:mm");

            samp_time      = FindViewById <EditText>(Resource.Id.sampTime);
            samp_time.Text = tmnw;

            //取样人
            samp_people      = FindViewById <EditText>(Resource.Id.sampPeople);
            samp_people.Text = username;

            btSamp         = FindViewById <ToggleButton>(Resource.Id.btSamp);
            btSamp.Enabled = false;
            btSamp.SetBackgroundColor(Android.Graphics.Color.ParseColor("#e6e6e6"));
            btSamp.Click += OperateDialogBox;

            if (CommonFunction.mode == "NFC")
            {
                #region NFC 模式
                try
                {
                    m_nfcAdapter = NfcAdapter.GetDefaultAdapter(this);
                    if (m_nfcAdapter == null)
                    {
                        CommonFunction.ShowMessage("设备不支持NFC!", this, true);
                        return;
                    }
                    if (!m_nfcAdapter.IsEnabled)
                    {
                        CommonFunction.ShowMessage("请在系统设置中先启用NFC功能!", this, true);
                        return;
                    }

                    //m_nfcAdapter.SetNdefPushMessage(CreateNdefMessageCallback(), this, this);

                    mTechLists = new string[][] { new string[] { "Android.Nfc.Tech.MifareClassic" }, new string[] { "Android.Nfc.Tech.NfcA" } };
                    IntentFilter tech = new IntentFilter(NfcAdapter.ActionTechDiscovered);
                    mFilters = new IntentFilter[] { tech, };                                                                                                                     //存放支持technologies的数组

                    mPendingIntent = PendingIntent.GetActivity(this, 0, new Intent(this, typeof(YugaSamp)).AddFlags(ActivityFlags.SingleTop), PendingIntentFlags.UpdateCurrent); //intent过滤器,过滤类型为NDEF_DISCOVERED


                    //Mifare卡和Desfare卡都是ISO - 14443 - A卡
                    ProcessAdapterAction(this.Intent);
                }
                catch (Exception ex)
                {
                    CommonFunction.ShowMessage(ex.Message, this, true);
                }

                #endregion
            }
            else if (CommonFunction.mode == "SerialPort")
            {
                #region SerialPort模式
                try
                {
                    Stream im;
                    Stream om;
                    serial = new SerialPort(13, 115200, 0);
                    serial.Power_5Von();

                    im = serial.MFileInputStream;
                    om = serial.MFileOutputStream;

                    hf = new HfReader(im, om);
                }
                catch (Exception ex)
                {
                    CommonFunction.ShowMessage(ex.Message, this, true);
                }
                #endregion
            }
        }
Example #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.RandomSamp);

            LoginSystemType = Intent.GetStringExtra("LoginSystemType");
            username        = Intent.GetStringExtra("username");

            //摇号抽样按钮
            btExtra         = FindViewById <ToggleButton>(Resource.Id.btExtract);
            btExtra.Click  += extractSamp;
            btExtra.Enabled = false;
            btExtra.SetBackgroundColor(Android.Graphics.Color.ParseColor("#E6E6E6"));

            //不摇号取样按钮
            btNoExtra         = FindViewById <ToggleButton>(Resource.Id.btNoExtra);
            btNoExtra.Click  += noExtraSamp;
            btNoExtra.Enabled = true;
            btNoExtra.SetBackgroundColor(Android.Graphics.Color.ParseColor("#BD2B32"));

            //计量通行证号
            cmeasure_Id = FindViewById <EditText>(Resource.Id.cMeasureId);
            //地点
            samp_adress      = FindViewById <EditText>(Resource.Id.sampAdress);
            samp_adress.Text = "合金库";

            //供应商
            samp_factory = FindViewById <EditText>(Resource.Id.sampFactory);
            //存货名称
            samp_goodsname = FindViewById <EditText>(Resource.Id.sampGoodsname);
            //车号
            samp_carNumber = FindViewById <EditText>(Resource.Id.sampCarNum);
            //取样包数
            samp_bags = FindViewById <EditText>(Resource.Id.bagCount);
            //抽取包数
            extra_bags = FindViewById <EditText>(Resource.Id.extractBags);
            //业务类型下拉菜单
            sp_mode = FindViewById <Spinner>(Resource.Id.sampMode);

            //填充数据
            sp_mode.ItemSelected += selectMode_ItemSelected;
            //数据库查询 暂时不用
            //bsif.sampModeNameList = bsif.selectSampMode();
            //填充数据 数据库数据
            //ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, bsif.sampModeNameList);
            //adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            //sp_mode.Adapter = adapter;

            //填充xml文件数据
            ArrayAdapter adapter_mode = ArrayAdapter.CreateFromResource(this, Resource.Array.SampMode, Android.Resource.Layout.SimpleSpinnerItem);

            adapter_mode.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            sp_mode.Adapter = adapter_mode;
            sp_mode.Prompt  = "请选择";

            //取样包数文本框改变事件
            //editText没有焦点
            samp_bags.TextChanged += TextChange;

            if (CommonFunction.mode == "NFC")
            {
                #region NFC 模式
                try
                {
                    m_nfcAdapter = NfcAdapter.GetDefaultAdapter(this);
                    if (m_nfcAdapter == null)
                    {
                        CommonFunction.ShowMessage("设备不支持NFC!", this, true);
                        return;
                    }
                    if (!m_nfcAdapter.IsEnabled)
                    {
                        CommonFunction.ShowMessage("请在系统设置中先启用NFC功能!", this, true);
                        return;
                    }

                    //m_nfcAdapter.SetNdefPushMessage(CreateNdefMessageCallback(), this, this);

                    mTechLists = new string[][] { new string[] { "Android.Nfc.Tech.MifareClassic" }, new string[] { "Android.Nfc.Tech.NfcA" } };
                    IntentFilter tech = new IntentFilter(NfcAdapter.ActionTechDiscovered);
                    mFilters = new IntentFilter[] { tech, };                                                                                                                        //存放支持technologies的数组

                    mPendingIntent = PendingIntent.GetActivity(this, 0, new Intent(this, typeof(RandomClass)).AddFlags(ActivityFlags.SingleTop), PendingIntentFlags.UpdateCurrent); //intent过滤器,过滤类型为NDEF_DISCOVERED


                    //Mifare卡和Desfare卡都是ISO - 14443 - A卡
                    ProcessAdapterAction(this.Intent);
                }
                catch (Exception ex)
                {
                    CommonFunction.ShowMessage(ex.Message, this, true);
                }
                #endregion
            }
            else if (CommonFunction.mode == "SerialPort")
            {
                #region SerialPort模式
                try
                {
                    Stream im;
                    Stream om;
                    serial = new SerialPort(13, 115200, 0);
                    serial.Power_5Von();

                    im = serial.MFileInputStream;
                    om = serial.MFileOutputStream;

                    hf = new HfReader(im, om);
                }
                catch (Exception ex)
                {
                    CommonFunction.ShowMessage(ex.Message, this, true);
                }
                #endregion
            }
        }
Example #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.Unload);
            UserName = Intent.GetStringExtra("username");

            bunload         = FindViewById <ToggleButton>(Resource.Id.buUnLoad);
            bunload.Enabled = false;
            bunload.Click  += OperateDialogBox;

            bhalfreturn         = FindViewById <ToggleButton>(Resource.Id.buHalfReturn);
            bhalfreturn.Enabled = false;
            bhalfreturn.Click  += OperateDialogBox;

            ballreturn         = FindViewById <ToggleButton>(Resource.Id.buAllReturn);
            ballreturn.Enabled = false;
            ballreturn.Click  += OperateDialogBox;

            bunloadandload         = FindViewById <ToggleButton>(Resource.Id.buUnloadAndLoad);
            bunloadandload.Enabled = false;
            bunloadandload.Click  += OperateDialogBox;

            UserName = Intent.GetStringExtra("username");
            EditText person = FindViewById <EditText>(Resource.Id.tuPerson);

            person.Text = UserName;

            EditText buckleweight = FindViewById <EditText>(Resource.Id.eBuckleWeight);

            buckleweight.TextChanged += Buckleweight_TextChanged;

            if (CommonFunction.mode == "NFC")
            {
                #region NFC 模式
                try
                {
                    m_nfcAdapter = NfcAdapter.GetDefaultAdapter(this);
                    if (m_nfcAdapter == null)
                    {
                        CommonFunction.ShowMessage("设备不支持NFC!", this, true);
                        return;
                    }
                    if (!m_nfcAdapter.IsEnabled)
                    {
                        CommonFunction.ShowMessage("请在系统设置中先启用NFC功能!", this, true);
                        return;
                    }

                    //m_nfcAdapter.SetNdefPushMessage(CreateNdefMessageCallback(), this, this);

                    mTechLists = new string[][] { new string[] { "Android.Nfc.Tech.MifareClassic" }, new string[] { "Android.Nfc.Tech.NfcA" } };
                    IntentFilter tech = new IntentFilter(NfcAdapter.ActionTechDiscovered);
                    mFilters = new IntentFilter[] { tech, };                                                                                                                   //存放支持technologies的数组

                    mPendingIntent = PendingIntent.GetActivity(this, 0, new Intent(this, typeof(Unload)).AddFlags(ActivityFlags.SingleTop), PendingIntentFlags.UpdateCurrent); //intent过滤器,过滤类型为NDEF_DISCOVERED


                    //Mifare卡和Desfare卡都是ISO - 14443 - A卡
                    ProcessAdapterAction(this.Intent);
                }
                catch (Exception ex)
                {
                    CommonFunction.ShowMessage(ex.Message, this, true);
                }

                #endregion
            }
            else if (CommonFunction.mode == "SerialPort")
            {
                #region SerialPort模式
                try
                {
                    Stream im;
                    Stream om;
                    serial = new SerialPort(13, 115200, 0);
                    serial.Power_5Von();

                    im = serial.MFileInputStream;
                    om = serial.MFileOutputStream;

                    hf = new HfReader(im, om);
                }
                catch (Exception ex)
                {
                    CommonFunction.ShowMessage(ex.Message, this, true);
                }
                #endregion
            }
        }