예제 #1
0
        private void txtQty_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode != Keys.Enter)
            {
                return;
            }
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                if (AppUtil.AlertMust(txtQty, "数量不允许为空"))
                {
                    return;
                }
                txtbarcode.Focus();
                txtbarcode.SelectAll();
            }
            catch (Exception ex)
            {
                logger.ErrorException("FrmScan窗体txtorderNo_KeyDown事件:" + ex.Message, ex);
                AppUtil.ShowError("操作失败!原因:" + ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
예제 #2
0
        private void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                DataTable dt = dgHead.DataSource as DataTable;
                if (dt == null || dt.Rows.Count == 0)
                {
                    AppUtil.ShowWarning("请先选择单据号!");
                    return;
                }

                QSCommonValue.operData = dt;

                this.ParentForm.LoadView(typeof(FrmScan), false, true);
            }
            catch (Exception ex)
            {
                logger.ErrorException("FrmHead窗体txtorderNo_KeyDown事件:" + ex.Message, ex);
                AppUtil.ShowError("操作失败!原因:" + ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
예제 #3
0
 public override void OnVisibleChanged()
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         Initialize();
     }
     catch (Exception ex)
     {
         logger.ErrorException("FrmScan窗体OnVisibleChanged事件:" + ex.Message, ex);
         AppUtil.ShowError("操作失败!详细信息请检查日志!");
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
예제 #4
0
 /// <summary>
 /// 扫描事件
 /// </summary>
 /// <param name="scanStr"></param>
 public override void OnGetBarcode(string scanStr)
 {
     Cursor.Current = Cursors.WaitCursor;
     try
     {
         txtUserId.Text = scanStr;
         txtUserPwd.Focus();
     }
     catch (Exception ex)
     {
         AppUtil.ShowError("扫描失败!详细信息请查看日志!");
         logger.ErrorException("FrmLogin窗体OnGetBarcode事件:" + ex.ToString(), ex);
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
예제 #5
0
 private void btnReturn_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor.Current               = Cursors.WaitCursor;
         QSCommonValue.operModule     = "CK1";
         QSCommonValue.operModuleName = btnReturn.Text;
         this.ParentForm.LoadView(typeof(FrmHead), false, true);
     }
     catch (Exception ex)
     {
         logger.ErrorException("FrmMenu窗体btnOut_Click事件:" + ex.Message, ex);
         AppUtil.ShowError("操作失败!详细信息请检查日志!");
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
예제 #6
0
        /// <summary>
        ///  新建单据在选择业务单据号后的处理
        /// </summary>
        /// <param name="dtSource">数据源</param>
        /// <param name=QSConstValue.VALUEMEMBER>实际输入的值</param>
        /// <param name="errorInfo">错误信息</param>
        /// <returns>True False</returns>
        protected bool DoAfterSelOrderNo(KgmGrid grid, EditControlInterface con, string inputvalue, out string errorInfo)
        {
            errorInfo = string.Empty;
            var biztype = string.Empty;

            try
            {
                biztype = grid.GetRowCellData("CVOUCHID", QSConstValue.VALUEMEMBER).ToString();
                if (string.IsNullOrEmpty(biztype))
                {
                    errorInfo = "业务类型不能为空!";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                AppUtil.ShowError(ex.ToString());
            }
            //设置过滤条件
            string rowfilter = string.Format(" AND ORDERNO = '{0}' ", inputvalue);
            //根据过滤条件读取单据信息
            //DataTable dtorderList = tbll.GetTVInfo(rowfilter);
            string jsonData = WebAPIUtil.ConvertObjToJson(rowfilter);

            DataTable dtorderList = WebAPIUtil.PostAPIByJsonToGeneric <DataTable>("api/tray/GetTVInfo", jsonData);

            if (dtorderList == null || dtorderList.Rows.Count == 0)
            {
                errorInfo = "未能获取到单据信息,请确认单据是否正确!";
                return(false);
            }

            //循环赋值
            if (!AppUtil.SetValueToGirdSource(grid, dtorderList.Rows[0], false))
            {
                return(false);
            }

            return(true);
        }
예제 #7
0
        /// <summary>
        /// 登录事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string errorInfo = string.Empty;

            try
            {
                Cursor.Current = Cursors.WaitCursor;

                StatusLable lblstatus = new StatusLable(lblLoadingInfo);

                if (!Login(lblstatus, out errorInfo))
                {
                    AppUtil.ShowInformation(errorInfo);
                    txtUserPwd.Text = string.Empty;
                    txtUserId.Focus();
                    txtUserId.SelectAll();
                    return;
                }
                lblstatus.UpdateMessage("正在读取用户信息...");
                //读取用户信息
                InitUserInfo();

                lblstatus.UpdateMessage("正在读取用户界面...");
                this.ParentForm.LoadView(typeof(FrmMenu), false, true);
                this.Dispose();
            }
            catch (Exception ex)
            {
                logger.ErrorException("FrmLogin:btnLogin_Click:" + ex.Message, ex);
                AppUtil.ShowError("QuickScanner登录失败,原因:" + ex.Message + "!");
            }
            finally
            {
                if (lblLoadingInfo != null)
                {
                    new StatusLable(lblLoadingInfo).UpdateMessage("准备就绪...");
                }
                Cursor.Current = Cursors.Default;
            }
        }
예제 #8
0
        static void Main()
        {
            try
            {
                string strAppName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
                IntPtr hMutex     = CreateMutex(IntPtr.Zero, true, strAppName);
                if (Marshal.GetLastWin32Error() == ERROR_ALREADY_EXISTS)
                {
                    ReleaseMutex(hMutex);
                    //通过Class找到对应的窗口句柄  #NETCF_AGL_BASE_ 为窗口的ClassName
                    IntPtr mainWin = FindWindowCE("#NETCF_AGL_BASE_", null);
                    //SetForegroundWindow函数将创建指定的窗口,并激活到前台窗口的线程
                    bool result = SetForegroundWindow(mainWin);
                    return;
                }
                else
                {
                    string strTerminal = AppUtil.GetXmlNodeValue(QSConstValue.TERMINAL_NODE);
                    //终端类型检查
                    if (string.IsNullOrEmpty(strTerminal) || !KgmUtil.IsInt(strTerminal) ||
                        !Enum.IsDefined(typeof(Terminal), int.Parse(strTerminal)))
                    {
                        AppUtil.ShowError("终端类型不正确,请检查配置文件!");
                        return;
                    }

                    FrmMain frm = new FrmMain();
                    frm.Text = "金戈马条码管理软件-" + AppUtil.GetXmlNodeValue(QSConstValue.SERIALNO_NODE); //QSConstValue.FORM_TITLE;
                    frm.Term = (Terminal)Enum.Parse(typeof(Terminal), strTerminal, true);
                    frm.ScaleDown(true);
                    frm.LoadFormType = typeof(FrmLogin);
                    Application.Run(frm);
                }
            }
            catch (Exception ex)
            {
                AppUtil.ShowError(ex.ToString());
            }
        }
예제 #9
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         if (txtpassword.Text == "51029010")
         {
             this.DialogResult = DialogResult.OK;
         }
         else
         {
             AppUtil.ShowError("ÃÜÂëÊäÈë²»ÕýÈ·!");
         }
     }
     catch
     {
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
예제 #10
0
        private void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                DataTable dt = dgScan.DataSource as DataTable;
                if (dt == null || dt.Rows.Count == 0)
                {
                    AppUtil.ShowError("请至少扫描一条记录!");
                    return;
                }

                dt = WebAPIUtil.GetAPIByJsonToGeneric <DataTable>(string.Format("/api/scan/GetTempScanCy/{0}/{1}", QSCommonValue.ListHead.Rows[0]["F_EnCode"].ToString(), QSCommonValue.operModule));

                DataView dv = new DataView(dt);
                dv.RowFilter = "CYQTY <> 0";
                if (dv.Count > 0 && AppUtil.ShowQuestion("仍有货品未扫描完毕,是否确认完成?") != DialogResult.Yes)
                {
                    return;
                }
                WebAPIUtil.GetToAPIByJsonToAPIResult(string.Format("/api/scan/TempScanFinish/{0}/{1}", QSCommonValue.ListHead.Rows[0]["F_EnCode"].ToString(), QSCommonValue.operModule));
                AppUtil.ShowInformation("操作完成!");
                this.ParentForm.LoadView(typeof(FrmHead), false, true);
            }
            catch (Exception ex)
            {
                logger.ErrorException("FrmScan窗体txtorderNo_KeyDown事件:" + ex.Message, ex);
                AppUtil.ShowError("操作失败!原因:" + ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                txtbarcode.Focus();
                txtbarcode.Text = string.Empty;
            }
        }
예제 #11
0
        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;
            }
        }
예제 #12
0
        private void txtorderNo_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                if (e.KeyCode != Keys.Enter)
                {
                    return;
                }

                DataSet ds = WebAPIUtil.GetAPIByJsonToGeneric <DataSet>(string.Format("api/scan/GetList/{0}/{1}", txtorderNo.Text, QSCommonValue.operModule));
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    txtorderNo.Focus();
                    txtorderNo.SelectAll();
                    AppUtil.ShowError("未能找到单据信息,请确认单号是否正确!");
                    return;
                }

                if (Convert.ToInt32(ds.Tables[0].Rows[0]["F_Status"]) > 1)
                {
                    txtorderNo.Focus();
                    txtorderNo.SelectAll();
                    AppUtil.ShowError("单据已经完成!");
                    return;
                }

                if (QSCommonValue.operModule == "PD")
                {
                    if (Convert.ToInt32(ds.Tables[0].Rows[0]["F_Status"]) > 0)
                    {
                        txtorderNo.Focus();
                        txtorderNo.SelectAll();
                        AppUtil.ShowError("单据已经完成!");
                        return;
                    }
                }
                else
                {
                    if (Convert.ToInt32(ds.Tables[0].Rows[0]["F_Status"]) == 0)
                    {
                        txtorderNo.Focus();
                        txtorderNo.SelectAll();
                        AppUtil.ShowError("单据尚未审核!");
                        return;
                    }
                }

                QSCommonValue.ListHead = ds.Tables[0];
                QSCommonValue.Body     = ds.Tables[1];
                dgHead.DataSource      = QSCommonValue.Body;
            }
            catch (Exception ex)
            {
                logger.ErrorException("FrmHead窗体txtorderNo_KeyDown事件:" + ex.Message, ex);
                AppUtil.ShowError("操作失败!原因:" + ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }