コード例 #1
0
 private void txtFrameBarCode_Validating(object sender, CancelEventArgs e)
 {
     if (txtFrameBarCode.Text.Length > 0)
     {
         Frame oFrameTemp = new Frame();
         oFrameTemp.FilterActual          = true;
         oFrameTemp.FilterHasFrameContent = true;
         oFrameTemp.FillData();
         if (oFrameTemp.MainTable.Rows.Count > 0)
         {
             for (int i = oFrameTemp.MainTable.Rows.Count - 1; i >= 0; i--)
             {
                 DataRow r = oFrameTemp.MainTable.Rows[i];
                 if (r["BarCode"].ToString().Contains(txtFrameBarCode.Text.Trim()))
                 {
                     oFrameTemp.ID = Convert.ToInt32(r["ID"]);
                     break;
                 }
             }
         }
         if (oFrameTemp.ID == null)
         {
             WMSMessage.MessageBoxError("Нет доступных контейнеров с таким кодом...");
             txtFrameBarCode.Text = txtFrameID4.Text = "";
             return;
         }
         else
         {
             oFrame.ID = oFrameTemp.ID;
             FrameChoose();
         }
     }
 }
コード例 #2
0
 private void cboCellTargetAddress_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboCellTargetAddress.SelectedValue == null || cboCellTargetAddress.SelectedIndex < 0)
     {
         cboBufferCellTargetAddress.SelectedIndex = -1;
     }
     else
     {
         DataRow ct = oCellTarget.MainTable.Rows.Find((int)cboCellTargetAddress.SelectedValue);
         if (ct == null)
         {
             WMSMessage.MessageBoxError("Не найдена запись для ячейки-приемника с кодом " + ct["ID"].ToString() + "...");
             cboCellTargetAddress.SelectedIndex           =
                 cboBufferCellTargetAddress.SelectedIndex = -1;
         }
         else
         {
             if (ct["BufferCellID"] != DBNull.Value)
             {
                 oBufferCellTarget.ID = (int)ct["BufferCellID"];
                 cboBufferCellTargetAddress_Restore();
                 cboBufferCellTargetAddress.SelectedValue = oBufferCellTarget.ID;
             }
             else
             {
                 cboBufferCellTargetAddress.SelectedIndex = -1;
             }
         }
     }
 }
コード例 #3
0
        private void mniAddFrame_Click(object sender, EventArgs e)
        {
            // добавление целого контейнера

            // ячейка предназначена для контейнеров?
            if (!_bForFrames)
            {
                WMSMessage.MessageBoxError("Ячейка не предназначена для размещения контейнеров!");
                return;
            }

            // в ячейке есть место для еще одного контейнера?
            int nFramesQnt = 0;

            foreach (DataRow dr in oCell.TableCellsContents.Rows)
            {
                if (dr["Changes"].ToString() != "D")
                {
                    nFramesQnt++;
                }
            }
            if (nFramesQnt + 1 > _nMaxPalletQnt)
            {
                WMSMessage.MessageBoxError("В ячейке уже находится " + WMSPublic.WMSUtilities.Declen(nFramesQnt, "контейнер", "контейнера", "контейнеров") + ".\n" +
                                           "В ячейке невозможно разместить еще один контейнер!");
                return;
            }

            btnSave.Enabled     = false;
            btnAdd.Enabled      = false;
            btnEdit.Enabled     = false;
            btnDelete.Enabled   = false;
            btnGridSave.Enabled = true;
            btnGridUndo.Enabled = true;

            pnlDataChange.BorderStyle = BorderStyle.Fixed3D;
            pnlDataChange.Enabled     = true;

            cboFrame.Enabled     = true;
            cboGood.Enabled      = false;
            numQnt.Enabled       = false;
            cboGoodState.Enabled = false;
            cboOwner.Enabled     = false;

            cboFrame.SelectedValue     = -1;
            cboGood.SelectedValue      = -1;
            numQnt.Value               = 0;
            cboOwner.SelectedValue     = -1;
            cboGoodState.SelectedValue = -1;
            grdCellsContents.Enabled   = false;

            _cMode = "AF";
        }
コード例 #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int    nCellTargetID      = 0;
            int    nStoreZoneTargetID = 0;
            string sMessage           = "Создать операции для транспортировки контейнера\n";

            if (optCellTarget.Checked)
            {
                if (cboCellTargetAddress.SelectedIndex < 0)
                {
                    WMSMessage.MessageBoxError("Не выбрана ячейка...");
                    return;
                }
                nCellTargetID = (int)cboCellTargetAddress.SelectedValue;
                if (nCellTargetID == (int)cboCellSourceAddress.SelectedValue)
                {
                    WMSMessage.MessageBoxError("Выбрана та же ячейка...");
                    return;
                }
                sMessage = sMessage + "в ячейку " + cboCellTargetAddress.Text + "?";
            }
            else
            {
                if (cboStoresZonesTarget.SelectedIndex < 0)
                {
                    WMSMessage.MessageBoxError("Не выбрана складская зона...");
                    return;
                }
                nStoreZoneTargetID = (int)cboStoresZonesTarget.SelectedValue;
                if (nStoreZoneTargetID == (int)cboStoresZonesSource.SelectedValue)
                {
                    if (WMSMessage.MessageBoxYesNo("Выбрана та же складская зона: " + cboStoresZonesTarget.Text + "\nСоздать операции для перемещения контейнера\nв другую (ближайшую) ячейку той же складской зоны?") != DialogResult.Yes)
                    {
                        return;
                    }
                }
                sMessage = sMessage + "в зону " + cboStoresZonesTarget.Text + "?";
            }

            if (WMSMessage.MessageBoxYesNo(sMessage) == DialogResult.Yes)
            {
                oFrame.TrafficForFrameCreateManual((int)oFrame.ID, nCellTargetID, nStoreZoneTargetID);
            }

            if (oFrame.ErrorNumber == 0)
            {
                WMSMessage.MessageBoxInfo("Создано задание на транспортировку контейнера.");
                DialogResult = DialogResult.Yes;
                Dispose();
            }
        }
コード例 #5
0
        private bool FrameChoose()
        {
            WaitOn(this);

            bool bResult = true;

            oFrame.FillData();
            DataRow r = oFrame.MainTable.Rows[0];

            if (r == null)
            {
                WMSMessage.MessageBoxError("Не найдена запись для контейнера с кодом " + r["ID"].ToString() + "...");
                bResult = false;
            }
            else
            {
                // контейнер
                txtFrameBarCode.Text   = r["BarCode"].ToString();
                txtFrameOwner.Text     = r["OwnerName"].ToString();
                txtFrameGoodState.Text = r["GoodStateName"].ToString();
                chkStereo.Checked      = (bool)r["Stereo"];
                bResult = (oFrame.ErrorNumber == 0);
            }
            if (bResult)
            {
                // ячейка-источник
                oCellSource.ID = (int)r["CellID"];
                oCellSource.FillData();
                DataRow rcs = oCellSource.MainTable.Rows[0];
                if (rcs == null)
                {
                    WMSMessage.MessageBoxError("Не найдена ячейка, в которой находится контейнер...");
                    bResult = false;
                }
                else
                {
                    cboCellSourceAddress.SelectedValue      = oCellSource.ID;
                    cboStoresZonesSource.SelectedValue      = (int)rcs["StoreZoneID"];
                    cboStoresZonesTypesSource.SelectedValue = (int)rcs["StoreZoneTypeID"];
                    if (rcs["BufferCellID"] == DBNull.Value)
                    {
                        oBufferCellSource.ID = null;
                        cboBufferCellSourceAddress.SelectedIndex = -1;
                    }
                    else
                    {
                        oBufferCellSource.ID = (int)rcs["BufferCellID"];
                        oBufferCellSource.FillData();
                    }
                }
            }

            if (bResult)
            {
                bResult = cboCellSourceAddress_Restore() &&
                          cboBufferCellSourceAddress_Restore();
            }

            WaitOff(this);
            return(bResult);
        }
コード例 #6
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (grdCellsContents.CurrentRow == null)
            {
                return;
            }

            DataRow rd = oCell.TableCellsContents.Rows[bsCellsContents.Position];

            if (_bForFrames)
            {
                // контейнеры
                if (rd["FrameID"] == null || rd["FrameID"] == DBNull.Value)
                {
                    // там оказался товар без контейнера
                    if (WMSMessage.MessageBoxYesNo("В ячейке, предназначенной для контейнеров, обнаружен товар!\nУдалить товар?") == DialogResult.Yes)
                    {
                        rd["Changes"] = "D";
                    }
                    return;
                }
                else
                {
                    // контейнер
                    int nFrameID = (int)rd["FrameID"];
                    // в нем один товар?
                    int nI = 0;
                    foreach (DataRow r in oCell.TableCellsContents.Rows)
                    {
                        if ((int)r["FrameID"] == nFrameID)
                        {
                            nI++;
                        }
                    }
                    if (nI > 1)
                    {
                        // несколько товаров в контейнере
                        if (WMSMessage.MessageBoxYesNo("В контейнере находятся разные товары.\nУдалить все товары в контейнере?") == DialogResult.Yes)
                        {
                            foreach (DataRow r in oCell.TableCellsContents.Rows)
                            {
                                if ((int)r["FrameID"] == nFrameID)
                                {
                                    r["Changes"] = "D";
                                }
                            }
                        }
                        else
                        {
                            if (WMSMessage.MessageBoxYesNo("Удалить только текущий товар в контейнере?") == DialogResult.Yes)
                            {
                                rd["Changes"] = "D";
                            }
                        }
                    }
                    else
                    {
                        // один товар в контейнере
                        if (WMSMessage.MessageBoxYesNo("Удалить контейнер?") == DialogResult.Yes)
                        {
                            rd["Changes"] = "D";
                        }
                    }
                }
            }
            else
            {
                // товары
                if (WMSMessage.MessageBoxYesNo("Удалить товар?") == DialogResult.Yes)
                {
                    rd["Changes"] = "D";
                }
            }
        }
コード例 #7
0
        private void btnGridSave_Click(object sender, EventArgs e)
        {
            // сохранить в DataTable
            decimal nInBox    = 0;
            int     nBoxInPal = 0;

            switch (_cMode)
            {
            case "AF":
                // целый контейнер

                if (chkFrameNew.Checked)
                {
                    // новый контейнер, сразу с товаром и количеством - один товар
                    DataRow rFAdd = oCell.TableCellsContents.Rows.Add();

                    rFAdd["ID"]       = DBNull.Value;
                    rFAdd["FrameID"]  = -1;
                    rFAdd["FrameNew"] = true;
                    if (cboGood.SelectedValue != null && cboGood.SelectedValue != DBNull.Value && (int)cboGood.SelectedValue > 0)
                    {
                        rFAdd["PackingID"]    = cboGood.SelectedValue;
                        rFAdd["PackingAlias"] = cboGood.Text;
                    }
                    else
                    {
                        WMSMessage.MessageBoxError("Не указан товар!");
                        return;
                    }

                    if (numQnt.Value != 0)
                    {
                        rFAdd["Qnt"] = numQnt.Value;
                    }
                    else
                    {
                        WMSMessage.MessageBoxError("Не указано количество товара!");
                        return;
                    }

                    DataRow rFGood = oGood.MainTable.Rows.Find((int)cboGood.SelectedValue);
                    rFAdd["Weighting"] = rFGood["Weighting"];
                    nInBox             = (decimal)rFGood["InBox"];
                    nBoxInPal          = (int)rFGood["BoxInPal"];
                    if (nInBox != 0)
                    {
                        rFAdd["BoxQnt"] = (decimal)rFAdd["Qnt"] / nInBox;
                        if (nBoxInPal != 0)
                        {
                            rFAdd["BoxQnt"] = (decimal)rFAdd["Qnt"] / nInBox / nBoxInPal;
                        }
                    }
                    rFAdd["Changes"] = "A";
                }
                else
                {
                    // существующий контейнер
                    foreach (DataRow rc in oFrameAdd.TableFramesContents.Rows)
                    {
                        DataRow rCAdd = oCell.TableCellsContents.Rows.Add();
                        rCAdd["ID"]       = DBNull.Value;
                        rCAdd["FrameID"]  = cboFrame.SelectedValue;
                        rCAdd["FrameNew"] = false;

                        rCAdd["GoodStateID"]   = rc["GoodStateID"];
                        rCAdd["GoodStateName"] = rc["GoodStateName"];
                        rCAdd["OwnerID"]       = rc["OwnerID"];
                        rCAdd["OwnerName"]     = rc["OwnerName"];

                        rCAdd["PackingID"]    = rc["PackingID"];
                        rCAdd["PackingAlias"] = rc["PackingAlias"];
                        rCAdd["Qnt"]          = rc["Qnt"];

                        DataRow rCGood = oGood.MainTable.Rows.Find((int)cboGood.SelectedValue);
                        rCAdd["Weighting"] = rCGood["Weighting"];
                        nInBox             = (decimal)rCGood["InBox"];
                        nBoxInPal          = (int)rCGood["BoxInPal"];
                        if (nInBox != 0)
                        {
                            rCAdd["BoxQnt"] = (decimal)rCAdd["Qnt"] / nInBox;
                            if (nBoxInPal != 0)
                            {
                                rCAdd["BoxQnt"] = (decimal)rCAdd["Qnt"] / nInBox / nBoxInPal;
                            }
                        }
                        rCAdd["Changes"] = "A";
                    }
                }

                break;

            case "AP":

                // товар в контейнер или в ячейку

                DataRow rPAdd = oCell.TableCellsContents.Rows.Add();

                rPAdd["ID"] = DBNull.Value;

                if (_bForFrames && cboFrame.SelectedValue != null && cboFrame.SelectedValue != DBNull.Value && (int)cboFrame.SelectedValue > 0)
                {
                    rPAdd["FrameID"] = cboFrame.SelectedValue;
                }
                else
                {
                    rPAdd["FrameID"] = DBNull.Value;
                }

                if (cboGood.SelectedValue != null && cboGood.SelectedValue != DBNull.Value && (int)cboGood.SelectedValue > 0)
                {
                    rPAdd["PackingID"]    = cboGood.SelectedValue;
                    rPAdd["PackingAlias"] = cboGood.Text;
                }
                else
                {
                    WMSMessage.MessageBoxError("Не указан товар!");
                    return;
                }

                if (numQnt.Value != 0)
                {
                    rPAdd["Qnt"] = numQnt.Value;
                }
                else
                {
                    WMSMessage.MessageBoxError("Не указано количество товара!");
                    return;
                }

                if (cboGoodState.SelectedValue != null && cboGoodState.SelectedValue != DBNull.Value && (int)cboGoodState.SelectedValue > 0)
                {
                    rPAdd["GoodStateID"]   = cboGoodState.SelectedValue;
                    rPAdd["GoodStateName"] = cboGoodState.Text;
                }
                else
                {
                    WMSMessage.MessageBoxError("Не указано состояние товара!");
                    return;
                }

                if (cboOwner.SelectedValue != null && cboOwner.SelectedValue != DBNull.Value && (int)cboOwner.SelectedValue > 0)
                {
                    rPAdd["OwnerID"]   = cboOwner.SelectedValue;
                    rPAdd["OwnerName"] = cboOwner.Text;
                }
                else
                {
                    if (WMSMessage.MessageBoxYesNo("Не указан владелец товара!\nСохранить без указаниея владельца?") == DialogResult.Yes)
                    {
                        rPAdd["OwnerID"]   = DBNull.Value;
                        rPAdd["OwnerName"] = DBNull.Value;
                    }
                    else
                    {
                        return;
                    }
                }

                DataRow rPGood = oGood.MainTable.Rows.Find((int)cboGood.SelectedValue);
                rPAdd["Weighting"] = rPGood["Weighting"];
                nInBox             = (decimal)rPGood["InBox"];
                nBoxInPal          = (int)rPGood["BoxInPal"];
                if (nInBox != 0)
                {
                    rPAdd["BoxQnt"] = (decimal)rPAdd["Qnt"] / nInBox;
                    if (nBoxInPal != 0)
                    {
                        rPAdd["BoxQnt"] = (decimal)rPAdd["Qnt"] / nInBox / nBoxInPal;
                    }
                }

                rPAdd["Changes"] = "A";
                break;

            case "E":

                DataRow r = oCell.TableCellsContents.Rows[bsCellsContents.Position];
                if (numQnt.Value != 0)
                {
                    r["Qnt"] = numQnt.Value;
                }
                else
                {
                    WMSMessage.MessageBoxError("Не указано количество товара!");
                    return;
                }

                nInBox    = (decimal)r["InBox"];
                nBoxInPal = (int)r["BoxInPal"];
                if (nInBox != 0)
                {
                    r["BoxQnt"] = (decimal)r["Qnt"] / nInBox;
                    if (nBoxInPal != 0)
                    {
                        r["BoxQnt"] = (decimal)r["Qnt"] / nInBox / nBoxInPal;
                    }
                }

                r["Changes"] = "E";

                break;
            }
            btnGridUndo_Click(null, null);
        }
コード例 #8
0
        private void frmCellsMedication_Load(object sender, EventArgs e)
        {
            oCell.FillData();
            DataRow r = oCell.MainTable.Rows[0];

            _bForFrames = (bool)r["ForFrames"];
            if (r["MaxPalletQnt"] != DBNull.Value)
            {
                _nMaxPalletQnt = (decimal)r["MaxPalletQnt"];
            }
            else
            {
                if (r["StoreZoneMaxPalletQnt"] != DBNull.Value)
                {
                    _nMaxPalletQnt = (decimal)r["StoreZoneMaxPalletQnt"];
                }
                else
                {
                    _nMaxPalletQnt = 999999;
                }
            }
            if (r["FixedOwnerID"] != DBNull.Value)
            {
                _nFixedOwnerID = (int)r["FixedOwnerID"];
            }
            if (r["FixedGoodStateID"] != DBNull.Value)
            {
                _nFixedGoodStateID = (int)r["FixedGoodStateID"];
            }

            oCell.FillTableCellsContents(oCell.ID, false);
            oCell.TableCellsContents.Columns.Add("FrameNew", Type.GetType("System.Boolean"));
            oCell.TableCellsContents.Columns.Add("Changes", Type.GetType("System.String"));
            foreach (DataRow rd in oCell.TableCellsContents.Rows)
            {
                rd["Changes"] = "";
            }

            bsCellsContents.DataSource  = new DataView(oCell.TableCellsContents);
            grdCellsContents.DataSource = bsCellsContents;;
            bsCellsContents.Position    = 0;

            bool lResult = true;

            if (_bForFrames)
            {
                optFrame.Checked = true;
                lResult          = cboFrame_Restore();
            }
            else
            {
                optNotFrame.Checked = true;
            }
            if (lResult)
            {
                //  заполнение cbo-классификаторов
                lResult = cboGood_Restore() &&
                          cboOwner_Restore() &&
                          cboGoodState_Restore();
            }
            if (!lResult)
            {
                WMSMessage.MessageBoxError("Ошибка при заполнении классификаторов (контейнеры, товары)...");
                return;
            }
            cboFrame.SelectedValue     = -1;
            cboGood.SelectedValue      = -1;
            cboOwner.SelectedValue     = -1;
            cboGoodState.SelectedValue = -1;

            pnlDataChange.Enabled = false;
            btnAdd.Enabled        = true;
            btnEdit.Enabled       = false;
            btnDelete.Enabled     = false;
            btnGridSave.Enabled   = false;
            btnGridUndo.Enabled   = false;

            _bLoaded = true;
        }