Example #1
0
        private bool grdTrafficsGoods_Restore()
        {
            oTrafficGood.ClearError();
            oTrafficGood.ClearFilters();

            // собираем услови¤
            TermsSelect();

            grdTrafficsGoods.GetGridState();

            Report oReportTrafficsGoods = new Report();

            oReportTrafficsGoods.ReportTraffics("Goods",
                                                oCellSource.MainTable, oCellTarget.MainTable,
                                                dDateBegBirth, dDateEndBirth,
                                                dDateBegConfirm, dDateEndConfirm,
                                                bConfirmed, bSuccess, null,
                                                sSelectedUsersIDList, null,
                                                "",
                                                sSelectedPackingsIDList);

            grdTrafficsGoods.IsLockRowChanged = true;
            grdTrafficsGoods.Restore(oReportTrafficsGoods.MainTable);

            return(oReportTrafficsGoods.ErrorNumber == 0);
        }
Example #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (grdData.CurrentRow == null)
            {
                return;
            }

            // перечитаем текущее состояние задания
            oTrafficCur.ClearError();
            oTrafficCur.ClearData();
            oTrafficCur.ClearFilters();
            oTrafficCur.ID = (int)grdData.CurrentRow.Cells["grcID"].Value;
            oTrafficCur.FillData();
            if (oTrafficCur.ErrorNumber != 0 || oTrafficCur.MainTable.Rows.Count != 1)
            {
                return;
            }

            DataRow r = oTrafficCur.MainTable.Rows[0];

            if ((bool)r["IsConfirmed"])
            {
                RFMMessage.MessageBoxError("Задание уже подтверждено.\n" +
                                           "Изменение невозможно.");
                return;
            }

            if (r["DateAccept"] != DBNull.Value)
            {
                RFMMessage.MessageBoxError("Задание уже выполняется.\n" +
                                           "Изменение невозможно.");
                return;
            }

            if (StartForm(new frmTrafficsGoodsEdit((int)oTrafficCur.ID)) == DialogResult.Yes)
            {
                grdData_Restore();
            }
        }
Example #3
0
        private bool grdData_Restore()
        {
            RFMCursorWait.Set(true);
            RFMCursorWait.LockWindowUpdate(FindForm().Handle);

            oTrafficCur.ID = null;

            oTrafficList.ClearError();
            oTrafficList.ClearFilters();
            oTrafficList.ID     = null;
            oTrafficList.IDList = null;

            // собираем условия

            // штрих-код
            //if (txtBarCode.Text.Trim().Length > 0)
            //    oTrafficList.BarCode = txtBarCode.Text.Trim();
            // даты
            if (!dtrDates.dtpBegDate.IsEmpty)
            {
                oTrafficList.FilterDateBeg = dtrDates.dtpBegDate.Value.Date;
            }
            if (!dtrDates.dtpEndDate.IsEmpty)
            {
                oTrafficList.FilterDateEnd = dtrDates.dtpEndDate.Value.Date;
            }
            // ИСТОЧНИК
            // ячейка
            Cell oCellSource = new Cell();

            oCellSource.ClearData();
            if ((txtCellSourceBarCode.Text.Trim().Length > 0) |
                (txtCellSourceAddress.Text.Trim().Length > 0))
            {
                if (txtCellSourceBarCode.Text.Trim().Length > 0)
                {
                    oCellSource.BarCode = txtCellSourceBarCode.Text.Trim();
                }
                if (txtCellSourceAddress.Text.Trim().Length > 0)
                {
                    oCellSource.FilterAddress = txtCellSourceAddress.Text.Trim();
                }
                oCellSource.FillData();
                if (oCellSource.MainTable.Rows.Count > 0)
                {
                    StringBuilder sbCS = new StringBuilder("");
                    foreach (DataRow r in oCellSource.MainTable.Rows)
                    {
                        sbCS = sbCS.Append(r["ID"].ToString() + ",");
                    }
                    if (sbCS.Length > 0)
                    {
                        oTrafficList.FilterCellsSourceList = sbCS.ToString();
                    }
                }
                else
                {
                    oTrafficList.FilterCellsSourceList = "-1";
                }
            }
            // зоны
            if (sSelectedStoresZonesSourceIDList.Length > 0)
            {
                oTrafficList.FilterStoresZonesSourceList = sSelectedStoresZonesSourceIDList;
            }
            if (sSelectedStoresZonesTypesSourceIDList.Length > 0)
            {
                oTrafficList.FilterStoresZonesTypesSourceList = sSelectedStoresZonesTypesSourceIDList;
            }
            // ПРИЕМНИК
            // ячейка
            Cell oCellTarget = new Cell();

            oCellTarget.ClearData();
            if ((txtCellTargetBarCode.Text.Trim().Length > 0) |
                (txtCellTargetAddress.Text.Trim().Length > 0))
            {
                if (txtCellTargetBarCode.Text.Trim().Length > 0)
                {
                    oCellTarget.BarCode = txtCellTargetBarCode.Text.Trim();
                }
                if (txtCellTargetAddress.Text.Trim().Length > 0)
                {
                    oCellTarget.FilterAddress = txtCellTargetAddress.Text.Trim();
                }
                oCellTarget.FillData();
                if (oCellTarget.MainTable.Rows.Count > 0)
                {
                    StringBuilder sbCT = new StringBuilder("");
                    foreach (DataRow r in oCellTarget.MainTable.Rows)
                    {
                        sbCT = sbCT.Append(r["ID"].ToString() + ",");
                    }
                    if (sbCT.Length > 0)
                    {
                        oTrafficList.FilterCellsTargetList = sbCT.ToString();
                    }
                }
                else
                {
                    oTrafficList.FilterCellsTargetList = "-1";
                }
            }
            // зоны
            if (sSelectedStoresZonesTargetIDList.Length > 0)
            {
                oTrafficList.FilterStoresZonesTargetList = sSelectedStoresZonesTargetIDList;
            }
            if (sSelectedStoresZonesTypesTargetIDList.Length > 0)
            {
                oTrafficList.FilterStoresZonesTypesTargetList = sSelectedStoresZonesTypesTargetIDList;
            }

            // состояние операций
            if (optNotConfirmed.Checked)
            {
                oTrafficList.FilterConfirmed = false;
            }
            if (optSuccess.Checked)
            {
                oTrafficList.FilterConfirmed = true;
                oTrafficList.FilterSuccess   = true;
            }
            if (optNotSuccess.Checked)
            {
                oTrafficList.FilterConfirmed = true;
                oTrafficList.FilterSuccess   = false;
            }

            // приходы-расходы
            if (txtInputBarCode.Text.Length > 0)
            {
                Input oInputFilter = new Input();
                oInputFilter.BarCode = txtInputBarCode.Text.Trim();
                oInputFilter.FillData();
                // если не нашли ни одного прихода по указанному штрих-коду,
                // все равно должны передать "", чтобы не получить ни одного перемещения
                string sInputBarCode = "";
                foreach (DataRow r in oInputFilter.MainTable.Rows)
                {
                    sInputBarCode = sInputBarCode + "," + r["ID"].ToString();
                }
                oTrafficList.FilterInputsList = sInputBarCode;
            }
            if (txtOutputBarCode.Text.Length > 0)
            {
                Output oOutputFilter = new Output();
                oOutputFilter.BarCode = txtOutputBarCode.Text.Trim();
                oOutputFilter.FillData();
                // если не нашли ни одного прихода по указанному штрих-коду,
                // все равно должны передать "", чтобы не получить ни одного перемещения
                string sOutputBarCode = "";
                foreach (DataRow r in oOutputFilter.MainTable.Rows)
                {
                    sOutputBarCode = sOutputBarCode + "," + r["ID"].ToString();
                }
                oTrafficList.FilterOutputsList = sOutputBarCode;
            }

            // пользователи
            if (sSelectedUsersIDList.Length > 0)
            {
                oTrafficList.FilterUsersList = sSelectedUsersIDList;
            }
            // выбранные товары
            if (sSelectedPackingIDList.Length > 0)
            {
                oTrafficList.FilterPackingsList = sSelectedPackingIDList;
            }
            //

            grdData.GetGridState();

            oTrafficList.FillData();

            grdData.IsLockRowChanged = true;
            grdData.Restore(oTrafficList.MainTable);

            //grdData.GridSource.Sort = "ID desc";

            RFMCursorWait.LockWindowUpdate(IntPtr.Zero);
            RFMCursorWait.Set(false);

            return(oTrafficList.ErrorNumber == 0);
        }