Esempio n. 1
0
        public HttpResponseMessage Login(string userName, string password)
        {
            try
            {
                CnasRemotCall remoteCall = new CnasRemotCall();
                SortedList    filter     = new SortedList();
                filter.Add(1, userName);
                filter.Add(2, password);

                string    testSql  = remoteCall.RemotInterface.CheckSelectData("HCS-userdata-sec004", filter);
                DataTable userInfo = remoteCall.RemotInterface.SelectData("HCS-userdata-sec004", filter);

                if (userInfo != null && userInfo.Rows.Count > 0)
                {
                    CnasBaseData.UserName = userName;
                    if (userInfo.Columns.Contains("si_id") && !(userInfo.Rows[0]["si_id"] is DBNull))
                    {
                        CnasBaseData.SystemID = Convert.ToString(userInfo.Rows[0]["si_id"]);
                        HttpContext.Current.Session["SystemID"] = Convert.ToString(userInfo.Rows[0]["si_id"]);
                    }
                    if (userInfo.Columns.Contains("id") && !(userInfo.Rows[0]["id"] is DBNull))
                    {
                        CnasBaseData.UserID = Convert.ToString(userInfo.Rows[0]["id"]);
                        HttpContext.Current.Session["UserId"] = CnasBaseData.UserID;
                    }
                    string sessionKey = string.Format("{0}:{1}", CnasBaseData.UserID.ToString(), "CnasUserInfo");
                    HttpContext.Current.Application[sessionKey] = HttpContext.Current.Session;
                    if (userInfo.Columns.Contains("user_bcode"))
                    {
                        CnasBaseData.UserBaseInfo = UserBaseHelper.GetUserByBarCode(Convert.ToString(userInfo.Rows[0]["user_bcode"]));
                        HttpContext.Current.Session["UserInfo"] = CnasBaseData.UserBaseInfo;
                    }
                    filter.Clear();
                    filter.Add(1, HttpContext.Current.Session["UserId"]);
                    testSql = remoteCall.RemotInterface.CheckSelectData("HCS-user-procedure-sec001", filter);
                    DataTable accessProcedure           = remoteCall.RemotInterface.SelectData("HCS-user-procedure-sec001", filter);
                    DataTable userDetail                = remoteCall.RemotInterface.SelectData("HCS-user-sec005", filter);
                    Dictionary <string, dynamic> result = new Dictionary <string, dynamic>();
                    result.Add("AccessWF", accessProcedure);
                    result.Add("UserInfo", userDetail);
                    result.Add("SessionKey", sessionKey);

                    HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, result);
                    HttpContext.Current.Session["AccessProcedure"]    = accessProcedure;
                    HttpContext.Current.Session["WorkflowArithmetic"] = new WorkflowArithmeticClass();
                    SortedList condition = new SortedList();
                    condition.Add(1, HttpContext.Current.Session["SystemID"]);
                    CnasBaseData.SystemInfoData = remoteCall.RemotInterface.SelectData("HCS-systeminfo-sec001", condition);
                    return(response);
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, new HttpError("查询不到用户")));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, ex));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 处理扫描码
        /// </summary>
        /// <param name="barCode"></param>
        /// <returns></returns>
        private string HandleScanBarCode(string barCode)
        {
            string result = PromptMessageXmlHelper.Instance.GetPromptMessage("scanpass", EnumPromptMessage.warning);

            if (barCode.StartsWith("BCB"))
            {
                UserBase userInfo = UserBaseHelper.GetUserByBarCode(barCode);
                if (_isPackuserTxtFocused)
                {
                    if (ScanBarCodes.ContainsValue("BCB"))
                    {
                        int index = ScanBarCodes.IndexOfValue("BCB");
                        ScanBarCodes.RemoveAt(index);
                    }
                    ScanBarCodes.Add(barCode, "BCB");
                    packUserTxt.Text      = userInfo.UserName;
                    packUserTxt.Tag       = userInfo.UserID;
                    _isPackuserTxtFocused = false;
                    cfmUserTxt.Focus();
                }
                else
                {
                    cfmUserTxt.Text = userInfo.UserName;
                    cfmUserTxt.Tag  = userInfo.UserID;
                    result          = PromptMessageXmlHelper.Instance.GetPromptMessage("cfmUserOk", EnumPromptMessage.warning);
                }
            }
            return(result);
        }
Esempio n. 3
0
        public override string HandleScanBarCode(string barCode)
        {
            string result = string.Empty;

            if (barCode.StartsWith("BCB"))
            {
                UserBase user = UserBaseHelper.GetUserByBarCode(barCode);
                if (user != null && user.UserID > 0)
                {
                    _confirmUser        = user;
                    txtConfirmName.Text = _confirmUser.UserName;
                    txtConfirmName.Tag  = user.UserID;

                    //HasManualHandle = false;
                    _createDate = DateTime.Now;
                    result      = PromptMessageXmlHelper.Instance.GetPromptMessage("cfmUserOk", EnumPromptMessage.warning);
                }
                else
                {
                    result = PromptMessageXmlHelper.Instance.GetPromptMessage("notfindUser", EnumPromptMessage.warning);
                }
            }
            else if (barCode.StartsWith("BCC"))
            {
                if (ScanBarCodes.ContainsValue("BCC"))
                {
                    result = "已存在要打包的器械包";
                }
            }
            if (txtConfirmName.Focused)
            {
                txtConfirmName.Text = _confirmUser != null ? _confirmUser.UserName : string.Empty;
            }
            return(result);
        }
Esempio n. 4
0
        void OnWorkSpaceScaned(BarCodeHook.BarCodes barCode)
        {
            string matchBarCode = BarCodeHelper.GetMatchBarCode(barCode.BarCode);

            setBarCodeTxt.Text = string.Empty;
            if (matchBarCode.StartsWith("BCB"))
            {
                UserBase userInfo = UserBaseHelper.GetUserByBarCode(matchBarCode);
                searchdata(userInfo);
            }

            else if (matchBarCode.StartsWith("BCC"))
            {
                //定位到指定包
                dgv_01.ClearSelection();
                setBarCodeTxt.Text = matchBarCode;
                foreach (DataGridViewRow item in dgv_01.Rows)
                {
                    if (item.Cells["set_code"] != null &&
                        item.Cells["set_code"].Value.ToString() == matchBarCode)
                    {
                        item.Selected = true;
                        //rexxie需要考虑是否直接弹出手动处理
                        //tsm_hand_Click(null, null);
                        break;
                    }
                }
            }
        }
Esempio n. 5
0
        private void OnCfmUserKeyDown(object sender, KeyEventArgs e)
        {
            TimeSpan ts      = DateTime.Now.Subtract(_firstTime);
            TextBox  textBox = sender as TextBox;

            if (e.KeyData == Keys.Enter && _canKeyDown)
            {
                if (textBox != null)
                {
                    Label    messageLbl = CnasUtilityTools.FindControl <Label>(this.ParentForm, "resultLbl");
                    UserBase user       = null;
                    if (textBox.Text.StartsWith("BCB") || string.IsNullOrEmpty(textBox.Text))
                    {
                        return;
                    }
                    else
                    {
                        user = UserBaseHelper.UserInfoByUserName(textBox.Text);
                    }
                    if (user != null && user.UserID > 0)
                    {
                        if (messageLbl != null)
                        {
                            messageLbl.Text = PromptMessageXmlHelper.Instance.GetPromptMessage("notfindUser", EnumPromptMessage.warning);
                        }
                        //MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("notfindUser", EnumPromptMessage.warning),
                        //"信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        _confirmUser = user;
                        textBox.Text = user.UserName;
                        textBox.Tag  = user.UserID;
                        if (messageLbl != null)
                        {
                            messageLbl.Text = PromptMessageXmlHelper.Instance.GetPromptMessage("cfmUserOk", EnumPromptMessage.warning);
                        }
                    }
                }
            }

            _firstTime = DateTime.Now;

            if (ts.Milliseconds < 20)
            {
                _canKeyDown = false;
            }
            else
            {
                _canKeyDown = true;
            }

            if (txtConfirmName.Focused)
            {
                txtConfirmName.Text = _confirmUser != null ? _confirmUser.UserName : string.Empty;
            }
        }
        public HCSWF_dialog_container(SortedList scanCodes, SortedList sl_Check, CnasHCSWorkflowInterface workflowServer, string pd_code, SortedList sL_parametertmp02, DataTable dtpartvalue, SortedList sL_parametersinfo)
            : base(scanCodes)

        {
            _sl_Check          = sl_Check;
            _sL_parametertmp02 = sL_parametertmp02;
            _pdcode            = pd_code;
            _sL_parametersinfo = sL_parametersinfo;
            _dtpartvalue       = dtpartvalue;
            Logger             = Logger ?? LogManager.GetLogger("CnasWNSClient");

            InitializeComponent();
            ControlViewBase viewBase = WorkFlowDialogGenerator.Instance.GeneratorWFDialog(PdCode);

            if (viewBase != null)
            {
                _workFlowView          = viewBase;
                DialogResultStatus     = viewBase.IsShown ? 1 : 0;
                _workFlowView.Sl_check = this._sl_Check;
                _workFlowView.Dock     = DockStyle.Fill;
                infoPanel.Controls.Add(viewBase);
                infoPanel.SetRow(viewBase, 0);
                _workFlowView.PdCode         = PdCode;
                _workFlowView.ScanBarCodes   = ScanBarCodes;
                _workFlowView.WorkflowServer = workflowServer as WorkflowArithmeticClass;
                if (ViewData.ContainsKey("UserInfo") && ViewData["UserInfo"] is UserBase)
                {
                    viewBase.UserInfo = ViewData["UserInfo"] as UserBase;
                }
                else
                {
                    UserBase userInfo = UserBaseHelper.GetUserByBarCode(BarCodeHelper.GetBarCodeByType("BCB", ScanBarCodes));
                    if (userInfo != null)
                    {
                        ViewData.Add("UserInfo", userInfo);
                        viewBase.UserInfo = userInfo;
                    }
                    else
                    {
                        Logger.Error(string.Format("Can not get user info. User barCode:{0}", BarCodeHelper.GetBarCodeByType("BCB", ScanBarCodes)));
                    }
                }
                MinimumSize = new Size((int)(_workFlowView.Width + mainPanel.ColumnStyles[1].Width + 100),
                                       viewBase.Height + 180);
            }
            else
            {
                DialogResultStatus = 0;
            }
            confirmBtn.Height  = buttonGroup.ItemHeight - 3;
            buttonPanel.Height = confirmBtn.Margin.Top + confirmBtn.Margin.Bottom + confirmBtn.Height * 2 +
                                 cancelBtn.Margin.Top + cancelBtn.Margin.Bottom;
            cancelBtn.Height           = confirmBtn.Height;
            confirmBtn.BackgroundImage = BarCodeHelper.GetBarcodeImage(_okBarCode, "确  认", confirmBtn.Width, confirmBtn.Height);
            cancelBtn.BackgroundImage  = BarCodeHelper.GetBarcodeImage(_closeBarCode, "关  闭", cancelBtn.Width, cancelBtn.Height);
        }
Esempio n. 7
0
 public override void InitalizeControl()
 {
     base.InitalizeControl();
     if (UserInfo == null)
     {
         UserInfo = UserBaseHelper.GetUserByBarCode(BarCodeHelper.GetBarCodeByType("BCB", ScanBarCodes))
                    ?? CnasBaseData.UserBaseInfo;
     }
     userNameTxt.Text = UserInfo.UserName;
     SetCarName();
     RefreshWorkSets();
 }
Esempio n. 8
0
        /// <summary>
        /// 登录按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void but_ok_Click(object sender, EventArgs e)
        {
            if (com_workare.Text.Trim() == "")
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("Configuration_tips", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (tex_user.Text.Trim() == "")
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("usernameRequired", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (tex_pwd.Text.Trim() == "")
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("userPassWordRequired", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //判断用户帐号密码是否 正确
            if (!(UserBaseHelper.CheckUserInfo(tex_user.Text.Trim(), tex_pwd.Text.Trim()) > 0))
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("userpassworderror", EnumPromptMessage.error), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //根据用户名,返回用户信息
            CnasBaseData.UserBaseInfo = UserBaseHelper.UserInfoByUserName(tex_user.Text.Trim());

            CnasBaseData.UserName = tex_user.Text.Trim();
            if (check_rec.Checked == true)
            {
                setsysxml(this.tex_user.Text, com_workare.SelectedIndex.ToString());
            }

            string str_ws   = com_workare.Text;
            string str_code = str_ws.Substring(0, 4);

            if (str_code == "9000")
            {
                CnasMain f_frmmin = new CnasMain();
                this.Hide();
                f_frmmin.Show();
            }
            else
            {
                CnasBaseData.UserAccessCustomer = GetUserAccessCustomers(str_code);
                var form = new HCSWF_Workspace(str_ws);
                this.Hide();
                form.ShowDialog();
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 根据用户条形码查询用户
        /// </summary>
        /// <param name="userBarCode">用户条形码</param>
        public void GetUserByBarCode(string userBarCode)
        {
            UserBase userInfo = UserBaseHelper.GetUserByBarCode(userBarCode);

            if (!ViewData.ContainsKey("UserInfo"))
            {
                ViewData.Add("UserInfo", userInfo);
            }
            else
            {
                ViewData["UserInfo"] = userInfo;
            }
        }
Esempio n. 10
0
        public virtual void InitalizeControl()
        {
            TextBox userNameTxt = CnasUtilityTools.FindControl <TextBox>(this, "userNameTxt");

            if (userNameTxt != null)
            {
                if (UserInfo == null && UserInfo.UserID == 0)
                {
                    UserInfo = UserBaseHelper.GetUserByBarCode(BarCodeHelper.GetBarCodeByType("BCB", ScanBarCodes))
                               ?? CnasBaseData.UserBaseInfo;
                }
                //userBarCodeTxt.Text = UserInfo.Userbcode;
                userNameTxt.Text = UserInfo.UserName;
            }
        }
Esempio n. 11
0
        public override void InitalizeControl()
        {
            //base.InitalizeControl();
            DataRow[] data = CnasBaseData.SystemBaseData.Select("key_code='CheckedSetInstrument' and type_code='HCS-system-settings'");
            if (data.Length > 0)
            {
                _isNeedCheckAll = data[0]["value_code"].ToString().Equals("1");
            }
            instrumentGrid.Columns["isPackagedCol"].Visible = _isNeedCheckAll;
            if (!_isNeedCheckAll)
            {
                txtConfirmName.Focus();
                //txtConfirmCode.Focus();
            }

            DataRow[] defaultType = CnasBaseData.SystemBaseData.Select("key_code ='DefaultPackInstrmentType' and type_Code ='HCS-system-settings'");
            if (defaultType.Length > 0 && defaultType[0]["value_code"] != null)
            {
                _defaluePackInstrumentType = defaultType[0]["value_code"].ToString();
            }
            string bcbCodes = BarCodeHelper.GetBarCodeByType("BCB", ScanBarCodes);

            string[] bcbCodeItems = bcbCodes.Split(',');
            if (bcbCodeItems.Length > 0)
            {
                UserInfo = UserBaseHelper.GetUserByBarCode(bcbCodeItems[0])
                           ?? CnasBaseData.UserBaseInfo;
                //userBarCodeTxt.Text = UserInfo.Userbcode;
                userNameTxt.Text = UserInfo.UserName;
                if (bcbCodeItems.Length > 1)
                {
                    _confirmUser = UserBaseHelper.GetUserByBarCode(bcbCodeItems[1]);
                    if (_confirmUser != null)
                    {
                        //userBarCodeTxt.Text = UserInfo.Userbcode;
                        userNameTxt.Text = UserInfo.UserName;
                    }
                }
            }

            InitalizeSetInfo();
            RefreshDataGrid();
        }
 private void searchdata(string indata)
 {
     //Cnas.wns.CnasMetroFramework.MetroMessageBox.Show(this, indata, "信息提示");
     if (indata.StartsWith("BCB"))
     {
         UserBase userInfo = UserBaseHelper.GetUserByBarCode(indata);
         if (userInfo != null)
         {
             _scannerHook.Stop();
             HCSSM_scan_barcode HCSSM_scanbarcode01 = new HCSSM_scan_barcode(CnasHCSWorkflowInterface01, userInfo, dtpdpart, dtapppd, dtpartvalue);
             if (!HCSSM_scanbarcode01.IsInternalError)
             {
                 HCSSM_scanbarcode01.ShowDialog();
                 _scannerHook.Start(false);
                 load_workorder("");
             }
         }
         else
         {
             MessageBox.Show(PromptMessageXmlHelper.GetPromptMessage("nouser", EnumPromptMessage.error, new string[] { indata }), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Esempio n. 13
0
        /// <summary>
        /// 相应keyDown事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnUserEnterKeyDown(object sender, KeyEventArgs e)
        {
            //if (e.KeyData == Keys.Enter)
            //{
            //	MetroTextBox textBox = sender as MetroTextBox;
            //	if (textBox != null)
            //	{
            //		UserBase user = null;
            //		if (textBox.Text.StartsWith("BCB") || string.IsNullOrEmpty(textBox.Text))
            //			return;
            //		else
            //			user = UserBaseHelper.UserInfoByUserName(textBox.Text);
            //		if (user == null)
            //		{
            //			textBox.Text = string.Empty;
            //			MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("notfindUser", EnumPromptMessage.warning),
            //				"信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //		}
            //
            //		else
            //		{
            //			if (textBox.Name == "packUserTxt")
            //			{
            //				packUserTxt.Tag = user.UserID;
            //			}
            //			else
            //			{
            //				cfmUserTxt.Tag = user.UserID;
            //			}
            //		}
            //
            //	}
            //}

            MetroTextBox textBox = sender as MetroTextBox;
            TimeSpan     ts      = DateTime.Now.Subtract(_firstTime);
            UserBase     user    = null;

            if (e.KeyData == Keys.Enter && _canKeyDown)
            {
                if (textBox != null)
                {
                    if (textBox.Text.StartsWith("BCB") && textBox.Text.Length >= 13)
                    {
                        user = UserBaseHelper.GetUserByBarCode(textBox.Text);
                    }
                    else
                    {
                        user = UserBaseHelper.UserInfoByUserName(textBox.Text);
                    }

                    if (user != null)
                    {
                        if (textBox.Name == "packUserTxt")
                        {
                            //_packUser = user;
                            if (ScanBarCodes.ContainsValue("BCB"))
                            {
                                int index = ScanBarCodes.IndexOfValue("BCB");
                                ScanBarCodes.RemoveAt(index);
                            }
                            ScanBarCodes.Add(user.Userbcode, "BCB");
                            //messageLbl.Text = PromptMessageXmlHelper.Instance.GetPromptMessage("packUserOk", EnumPromptMessage.warning);
                        }
                        else
                        {
                            //_confirmUser = user;
                            //messageLbl.Text = PromptMessageXmlHelper.Instance.GetPromptMessage("cfmUserOk", EnumPromptMessage.warning);
                        }

                        textBox.Text = user.UserName;
                        textBox.Tag  = user.UserID;
                    }
                    else
                    {
                        //messageLbl.Text = PromptMessageXmlHelper.Instance.GetPromptMessage("notfindUser", EnumPromptMessage.warning);
                    }
                }
            }

            _firstTime = DateTime.Now;
            if (ts.Milliseconds < 20)
            {
                _canKeyDown = false;
            }
            else
            {
                _canKeyDown = true;
            }
        }