/// <summary> /// 登录 /// </summary> /// <returns></returns> private bool Login(StatusLable lblstatus, out string strErrorMsg) { strErrorMsg = string.Empty; if (txtUserId.Text == string.Empty) { strErrorMsg = "请输入用户代码!"; return(false); } //只在第一次登陆执行 if (!initLogtin(lblstatus, out strErrorMsg)) { return(false); } lblstatus.UpdateMessage("正在登录系统..."); QSCommonValue.token = string.Empty; LoginSystemModel LogModel = new LoginSystemModel(); LogModel.Account = txtUserId.Text; LogModel.Password = txtUserPwd.Text; LogModel.LoginSystem = LoginSystemModel.LoginSystemEnum.移动端系统; string jsonData = WebAPIUtil.ConvertObjToJson(LogModel); //KgmApiResultEntity result = WebAPIUtil.PostAPIByJsonToAPIResult("/api/Auth/GetUserToken", jsonData); KgmApiResultEntity result = WebAPIUtil.PostAPIByJsonToAPIResult("api/Auth/GetUserToken", jsonData); if (!result.result) { strErrorMsg = result.message; return(false); } else { QSCommonValue.token = result.message; } return(true); }
private void txtorderNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.Enter) { return; } try { Cursor.Current = Cursors.WaitCursor; if (AppUtil.AlertMust(txtcPosCode, "货位不允许为空") || AppUtil.AlertMust(txtbarcode, "条码不允许为空") || AppUtil.AlertMust(txtQty, "数量不允许为空")) { return; } SaveScan s = new SaveScan(); s.BARCODE = txtbarcode.Text; s.BDEL = chkDel.Checked; s.CPOSCODE = txtcPosCode.Text; s.CWHCODE = QSCommonValue.ListHead.Rows[0]["F_WarehouseId"].ToString(); s.OPERUSER = QSCommonValue.CurrentUser.Userid; s.ORDERNO = QSCommonValue.ListHead.Rows[0]["F_EnCode"].ToString(); s.ORDERTYPE = QSCommonValue.operModule; try { s.QTY = decimal.Parse(txtQty.Text); } catch { AppUtil.ShowError("输入的数量格式不正确!"); return; } string jsonData = WebAPIUtil.ConvertObjToJson(s); KgmApiResultEntity result = WebAPIUtil.PostAPIByJsonToAPIResult("/api/scan/SaveTempScan", jsonData); if (result.result) { BindScanList(); txtbarcode.Focus(); txtbarcode.Text = string.Empty; txtQty.Text = "1"; chkDel.Checked = chkStatus.Checked = false; } else { AppUtil.ShowError(result.message); } } catch (Exception ex) { logger.ErrorException("FrmScan窗体txtorderNo_KeyDown事件:" + ex.Message, ex); AppUtil.ShowError("操作失败!原因:" + ex.Message); } finally { Cursor.Current = Cursors.Default; } }