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)); } }
/// <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); }
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); }
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; } } } }
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); }
public override void InitalizeControl() { base.InitalizeControl(); if (UserInfo == null) { UserInfo = UserBaseHelper.GetUserByBarCode(BarCodeHelper.GetBarCodeByType("BCB", ScanBarCodes)) ?? CnasBaseData.UserBaseInfo; } userNameTxt.Text = UserInfo.UserName; SetCarName(); RefreshWorkSets(); }
/// <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; } }
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; } }
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); } } }
/// <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; } }