示例#1
0
        private void ProfitLossDeal()
        {
            if (!Common.Common_Func.DialogMessage("是否确认进行盈亏处理?", "提示"))
            {
                return;
            }

            string strError = string.Empty;

            if (Check_Func.VerifyCheckStockChange(_check, ref strError))
            {
                if (!Common.Common_Func.DialogMessage("盘点库存在盘点期间发生过变动,是否继续进行盈亏处理?", "警告", 3))
                {
                    return;
                }
            }
            else
            {
            }

            if (!Check_Func.ProfitLossDeal(_check, ref strError))
            {
                Common.Common_Func.ErrorMessage(strError, "处理失败", 2);
            }
            else
            {
                Common.Common_Func.ErrorMessage("处理完成", "提示");
                tsmiDeal.Enabled = false;
            }
        }
示例#2
0
        private void BindComboBoxs()
        {
            Common.Common_Func.BindComboBoxAddAll(Check_Func.GetProfitLoss(), cbbProfitLoss);

            bsMain.ResetBindings(false);
            bsMain.EndEdit();
        }
示例#3
0
        private void GetListQueryData()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                bsMain.EndEdit();

                bool   bResult = false;
                string strErr  = string.Empty;
                GetQueryMain();

                ChensControl.DividPage clientPage = pageList.dDividPage;
                Common.Common_Func.GetServerPageFromClientPage(ref _serverMainPage, clientPage);
                bResult = Check_Func.GetCheckAnalyseListByPage(ref lstMain, queryMain, ref _serverMainPage, ref strErr);
                Common.Common_Func.GetClientPageFromServerPage(_serverMainPage, ref clientPage);
                pageList.ShowPage();
                dgvList.DataSource = lstMain;

                if (!bResult || !string.IsNullOrEmpty(strErr))
                {
                    Common.Common_Func.ErrorMessage(strErr, "查询失败", 2);
                }
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message, "查询失败", 2);
            }
            finally
            {
                this.Cursor = Cursors.Default;
                txtAreaNo.Focus();
            }
        }
示例#4
0
        private bool SaveData()
        {
            cbxSelectAll.Focus();
            dgvList.EndEdit();
            bsMain.EndEdit();

            GetReCheckData();

            if (!CheckInput())
            {
                return(false);
            }

            string strErr = string.Empty;

            if (Check_Func.SaveCheck(ref _recheck, ref strErr))
            {
                Common.Common_Func.ErrorMessage(string.Format("复盘单保存成功!{0}盘点单号为:【{1}】", Environment.NewLine, _recheck.CheckNo), "保存成功");
                //bsMain.DataSource = _recheck;
                //InitForm();
                tsmiReCheck.Enabled = false;
                gbBottom.Enabled    = false;
                return(true);
            }
            else
            {
                Common.Common_Func.ErrorMessage(strErr, "保存失败", 2);
                //bsMain.DataSource = _recheck;
                return(false);
            }
        }
示例#5
0
        private void UpdateCheckStatus(CheckInfo check)
        {
            string strError = string.Empty;

            if (!Check_Func.UpdateCheckStatusByID(check, ref strError))
            {
                Common.Common_Func.ErrorMessage(strError, "操作失败", 2);
            }

            GetListQueryData();
        }
示例#6
0
        private void GetListQueryData()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                bsMain.EndEdit();

                bool   bResult  = false;
                string strError = string.Empty;
                GetQueryList();

                if (_check.ID == 0)     //新增不取值
                {
                    lstMain            = (from m in lstMain orderby m.StockTime descending, m.WarehouseNo, m.HouseNo, m.AreaNo, m.MaterialNo select m).ToList();
                    dgvList.DataSource = lstMain;
                    bResult            = true;
                }
                else if (_check.CheckStatus == 1 && lstMain != null && lstMain.Count >= 1)  //编辑为空时取值
                {
                    lstMain            = (from m in lstMain orderby m.StockTime descending, m.WarehouseNo, m.HouseNo, m.AreaNo, m.MaterialNo select m).ToList();
                    dgvList.DataSource = lstMain;
                    bResult            = true;
                }
                else
                {
                    ChensControl.DividPage clientPage = pageList.dDividPage;
                    Common.Common_Func.GetServerPageFromClientPage(ref _serverListPage, clientPage);
                    if (!pageList.Visible)
                    {
                        _serverListPage.CurrentPageShowCounts = -1;
                    }
                    bResult = Check_Func.GetCheckDetailsListByPage(ref lstMain, queryList, ref _serverListPage, ref strError);
                    Common.Common_Func.GetClientPageFromServerPage(_serverListPage, ref clientPage);
                    pageList.ShowPage();
                    dgvList.DataSource = lstMain;
                }

                if (!bResult || !string.IsNullOrEmpty(strError))
                {
                    Common.Common_Func.ErrorMessage(strError, "查询失败", 2);
                }
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message, "查询失败", 2);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#7
0
        private CheckInfo GetListRowModel(int iRowIndex)
        {
            string    strErr = string.Empty;
            CheckInfo check  = new CheckInfo();

            check.ID = lstMain[iRowIndex].ID;

            if (!Check_Func.GetCheckByID(ref check, ref strErr))
            {
                Common.Common_Func.ErrorMessage(strErr, "读取失败", 2);
                GetListQueryData();
                return(null);
            }

            return(check);
        }
示例#8
0
        private void GetListQueryData()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                bsMain.EndEdit();

                bool   bResult = false;
                string strErr  = string.Empty;
                GetQueryMain();

                pageList.dDividPage.CurrentPageNumber = 1;
                pageList.CurrentPageShowCounts        = -1;

                ChensControl.DividPage clientPage = pageList.dDividPage;
                Common.Common_Func.GetServerPageFromClientPage(ref _serverMainPage, clientPage);
                bResult = Check_Func.GetCheckAnalyseListByPage(ref lstMain, queryMain, ref _serverMainPage, ref strErr);
                Common.Common_Func.GetClientPageFromServerPage(_serverMainPage, ref clientPage);
                pageList.ShowPage();
                dgvList.DataSource = lstMain;

                if (!bResult || !string.IsNullOrEmpty(strErr))
                {
                    Common.Common_Func.ErrorMessage(strErr, "查询失败", 2);
                }

                if (dgvList.DataSource == null || dgvList.Rows.Count <= 0)
                {
                }
                else
                {
                    dgvList.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2;
                }
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message, "查询失败", 2);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#9
0
        private void BindComboBoxs()
        {
            Common.Common_Func.BindComboxBoxByKey(cbbCheckType.Name, cbbCheckType);

            Common_Func.BindComboBoxAddAll(Check_Func.GetIsDifference(), cbbADifference);

            Common_Func.BindComboBoxAddAll(Check_Func.GetIsDifference(), cbbHDifference);

            Common_Func.BindComboBoxAddAll(Check_Func.GetIsDifference(), cbbWDifference);

            Common_Func.BindComboBoxAddAll(Check_Func.GetIsDifference(), cbbMDifference);

            Common_Func.BindComboBoxAddAll(Check_Func.GetIsDifference(), cbbKDifference);

            BindKeeperList();

            bsMain.ResetBindings(false);
            bsMain.EndEdit();
        }
示例#10
0
        private bool GetExportDetailData(ref List <ProfitLossInfo> lstExport)
        {
            bsMain.EndEdit();

            string strErrMsg = string.Empty;

            lstExport = new List <ProfitLossInfo>();
            ProfitLossInfo queryExport = new ProfitLossInfo();

            try
            {
                this.Cursor = Cursors.WaitCursor;

                queryExport.CheckID = queryMain.CheckID;
                //queryExport.AreaNo = queryMain.AreaNo;
                //queryExport.ProfitLoss = queryMain.ProfitLoss;

                DividPage serverPage = new DividPage();
                serverPage.CurrentPageNumber     = 1;
                serverPage.CurrentPageShowCounts = -1;

                if (!Check_Func.GetProfitLossListByPage(ref lstExport, queryExport, ref serverPage, ref strErrMsg))
                {
                    Common.Common_Func.ErrorMessage(strErrMsg, "导出失败", 2);
                    return(false);
                }

                lstExport.ForEach(t => t.CheckNo = _check.CheckNo);
                return(true);
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message, "导出失败", 2);
                return(false);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#11
0
        private void DeleteListRow(int iRowIndex)
        {
            CheckInfo check = GetListRowModel(iRowIndex);

            if (check == null)
            {
                return;
            }

            if (!Common.Common_Func.DialogMessage(string.Format("是否确认删除盘点【{0}】?", check.CheckNo), "确认删除"))
            {
                return;
            }

            try
            {
                if (check.IsDel != 2)
                {
                    string strErr = string.Empty;
                    if (!Check_Func.DeleteCheckByID(check, ref strErr))
                    {
                        Common.Common_Func.ErrorMessage(strErr, "删除失败", 2);
                        return;
                    }
                }

                Common.Common_Func.ErrorMessage("删除盘点成功", "删除成功");
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message);
            }
            finally
            {
                GetListQueryData();
            }
        }
示例#12
0
        private bool SaveData()
        {
            bsMain.EndEdit();
            tcFile.SelectedTab = tpDetail;
            _check.lstDetails  = lstMain;

            if (!CheckInput())
            {
                return(false);
            }

            if (_check.CheckType == 5)
            {
                _check.DutyUser = querySelect.Keeper;
            }
            else
            {
                _check.DutyUser = Common_Var.CurrentUser.UserNo;
            }

            string strErr = string.Empty;

            if (Check_Func.SaveCheck(ref _check, ref strErr))
            {
                Common.Common_Func.ErrorMessage(string.Format("盘点单保存成功!{0}盘点单号为:【{1}】", Environment.NewLine, _check.CheckNo), "保存成功");
                bsMain.DataSource = _check;
                InitForm();
                _back = Common.Common_Func.ConvertToModel <CheckInfo>(_check);
                return(true);
            }
            else
            {
                Common.Common_Func.ErrorMessage(strErr, "保存失败", 2);
                bsMain.DataSource = _check;
                return(false);
            }
        }
示例#13
0
        private void GetSelectQueryData()
        {
            TextBox txt = txtWWarehouse;

            ChensControl.ChensPage page = pageWarehouse;
            DataGridView           dgv  = dgvWarehouse;
            CheckBox cbx = cbxWSelectAll;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                bsMain.EndEdit();
                bsSelect.EndEdit();

                bool   bResult  = false;
                string strError = string.Empty;
                GetQuerySelect();

                #region 获取当前选项卡
                switch (querySelect.CheckType)
                {
                case 1:
                    txt  = txtWWarehouse;
                    page = pageWarehouse;
                    dgv  = dgvWarehouse;
                    cbx  = cbxWSelectAll;
                    if (dtpWStockStartTime.Checked)
                    {
                        querySelect.StartTime = dtpWStockStartTime.Value;
                    }
                    else
                    {
                        querySelect.StartTime = null;
                    }
                    if (dtpWStockEndTime.Checked)
                    {
                        querySelect.EndTime = dtpWStockEndTime.Value;
                    }
                    else
                    {
                        querySelect.EndTime = null;
                    }
                    break;

                case 2:
                    txt  = txtHWarehouse;
                    page = pageHouse;
                    dgv  = dgvHouse;
                    cbx  = cbxHSelectAll;
                    if (dtpHStockStartTime.Checked)
                    {
                        querySelect.StartTime = dtpHStockStartTime.Value;
                    }
                    else
                    {
                        querySelect.StartTime = null;
                    }
                    if (dtpHStockEndTime.Checked)
                    {
                        querySelect.EndTime = dtpHStockEndTime.Value;
                    }
                    else
                    {
                        querySelect.EndTime = null;
                    }
                    break;

                case 3:
                    txt  = txtAWarehouse;
                    page = pageArea;
                    dgv  = dgvArea;
                    cbx  = cbxASelectAll;
                    if (dtpAStockStartTime.Checked)
                    {
                        querySelect.StartTime = dtpAStockStartTime.Value;
                    }
                    else
                    {
                        querySelect.StartTime = null;
                    }
                    if (dtpAStockEndTime.Checked)
                    {
                        querySelect.EndTime = dtpAStockEndTime.Value;
                    }
                    else
                    {
                        querySelect.EndTime = null;
                    }
                    break;

                case 4:
                    txt  = txtMWarehouse;
                    page = pageMaterial;
                    dgv  = dgvMaterial;
                    cbx  = cbxMSelectAll;
                    if (dtpMStockStartTime.Checked)
                    {
                        querySelect.StartTime = dtpMStockStartTime.Value;
                    }
                    else
                    {
                        querySelect.StartTime = null;
                    }
                    if (dtpMStockEndTime.Checked)
                    {
                        querySelect.EndTime = dtpMStockEndTime.Value;
                    }
                    else
                    {
                        querySelect.EndTime = null;
                    }
                    break;

                case 5:
                    if (string.IsNullOrEmpty(querySelect.Keeper))
                    {
                        Common.Common_Func.ErrorMessage("保管员必须输入", "查询失败", 2);
                        return;
                    }

                    txt  = txtKKeeper;
                    page = pageKeeper;
                    dgv  = dgvKeeperMaterial;
                    cbx  = cbxMSelectAll;
                    if (dtpKStockStartTime.Checked)
                    {
                        querySelect.StartTime = dtpKStockStartTime.Value;
                    }
                    else
                    {
                        querySelect.StartTime = null;
                    }
                    if (dtpKStockEndTime.Checked)
                    {
                        querySelect.EndTime = dtpKStockEndTime.Value;
                    }
                    else
                    {
                        querySelect.EndTime = null;
                    }
                    break;

                default:
                    return;
                }

                #endregion

                if (querySelect.StartTime != null && querySelect.EndTime != null)
                {
                    if (querySelect.StartTime.ToDateTime().Date > querySelect.EndTime.ToDateTime().Date)
                    {
                        Common.Common_Func.ErrorMessage("开始日期不能大于结束日期", "查询失败", 2);
                        return;
                    }
                }

                if (lstSelect == null || lstSelect.Count <= 0)
                {
                    cbx.Checked = false;
                }
                ChensControl.DividPage clientPage = page.dDividPage;
                Common.Common_Func.GetServerPageFromClientPage(ref _serverSelectPage, clientPage);
                bResult = Check_Func.GetCheckDetailsSelectListByPage(ref lstSelect, querySelect, ref _serverSelectPage, ref strError);
                Common.Common_Func.GetClientPageFromServerPage(_serverSelectPage, ref clientPage);
                SetChecked();
                page.ShowPage();
                dgv.DataSource = lstSelect;

                if (!bResult || !string.IsNullOrEmpty(strError))
                {
                    lstSelect      = new List <CheckDetailsInfo>();
                    dgv.DataSource = lstSelect;
                    Common.Common_Func.ErrorMessage(strError, "查询失败", 2);
                }
            }
            catch (Exception ex)
            {
                Common.Common_Func.ErrorMessage(ex.Message, "查询失败", 2);
            }
            finally
            {
                this.Cursor = Cursors.Default;
                txt.Focus();
            }
        }