Ejemplo n.º 1
0
        // проверка поля
        private void AvtFieldValidating(object sender, CancelEventArgs e)
        {
            if (bEditMode == true)
            {
                TextBox xF = ((TextBox)sender);
                string  sT = xF.Text.Trim().ToUpper();
                if (sT.Length > 0)
                {
                    if (xF == tPutList)
                    {
                    }
                    if (xF == tTyag)
                    {
                        if (sT.Length < 4)
                        {
                            ServClass.ErrorMsg("Не меньше 4 цифр!");
                            e.Cancel = true;
                        }
                    }
                }

                if (e.Cancel != true)
                {
                    //((TextBox)sender).Text = sT;
                    //TestOpenAvail(cbGruzType.SelectedIndex, sender, sT);
                    //e.Cancel = !ServClass.TryEditNextFiled((Control)sender, nCurEditCommand, aEdVvod);
                }
                // перед уходом
                if (e.Cancel == false)
                {
                    xCurEdit = (Control)sender;
                }
            }
        }
Ejemplo n.º 2
0
        // добавление новой записи в документы
        public bool AddDocRec(CurDoc xD, DataGrid dgDoc)
        {
            bool ret = true;

            try
            {
                DataRow dr = DT[NSI.TBD_DOC].dt.NewRow();
                dr["SOURCE"] = DOCSRC_CRTD;

                ret = UpdateDocRec(dr, xD);
                if (ret == true)
                {
                    DT[NSI.TBD_DOC].dt.Rows.Add(dr);
                    xD.nId      = (int)dr["ID"];
                    xD.drCurRow = dr;
                    if (dgDoc != null)
                    {
                        dgDoc.CurrentRowIndex = ((System.ComponentModel.IListSource)dgDoc.DataSource).GetList().Count - 1;
                    }
                }
            }
            catch (System.Data.ConstraintException)
            {
                ret = false;
                ServClass.ErrorMsg("Документ уже существует");
            }
            catch (Exception ex)
            {
                ret = false;
                object x = ex.GetType();
            }
            return(ret);
        }
Ejemplo n.º 3
0
        // Версия софтины
        private void MMenuClick_AppVer(object sender, EventArgs e)
        {
            AssemblyName xAN = Assembly.GetExecutingAssembly().GetName();

            //MessageBox.Show(String.Format("Версия ПО - {0}", xAN.Version.ToString()), "Информация");
            ServClass.ErrorMsg(String.Format("Версия ПО - {0}", xAN.Version.ToString()), "Информация", true);

            CreateMMenu();
        }
Ejemplo n.º 4
0
        private int Read2D(BarcodeScannerEventArgs e)
        {
            int nRet = AppC.RC_OK,
                nLev;
            string s;



            s = e.Data;

            if (xAllDef == null)
            {
                DirectoryInfo di = new DirectoryInfo(xPars.sDataPath);
                FileInfo[]    fi = di.GetFiles("*.def");
                Def2Data      xOneDef;

                xAllDef = new List <Def2Data>();

                for (int i = 0; i < fi.Length; i++)
                {
                    xOneDef = new Def2Data();
                    nRet    = Read2DDef(fi[i].FullName, Encoding.GetEncoding(1251), xOneDef);
                    if (nRet == AppC.RC_OK)
                    {
                        nLev         = 0;
                        xOneDef.lDef = CreateArrOp(lDoc, ref nLev, 0);
                        xAllDef.Add(xOneDef);
                    }
                    else
                    {
                        ServClass.ErrorMsg(fi[i].FullName + "-ошибка в описании!");
                    }
                }

                xSer2D = new Ser2DSym(xNSI);
            }

            nRet = New2D(e.BinData, e.LenBinData);
            s    = "";
            if (nRet == AppC.RC_OK)
            {
                switch (xSer2D.State)
                {
                case READ2D_STATE.R_WAIT_SER:
                    s = "Записан - <" + sLastDoc + ">";
                    break;

                case READ2D_STATE.R_WAIT_NEXT:
                    break;
                }
            }
            //Show2DResult(REG_2D_SHOW, s);
            return(nRet);
        }
Ejemplo n.º 5
0
        private int GetAvtInf(int nCom)
        {
            int i,
                nRet = AppC.RC_OK;
            string         sErr, sSys = "";
            List <DataRow> aDR = new List <DataRow>();
            DataView       dv  = null;
            LoadFromSrv    dgL = null;

            if (xCUpLoad == null)
            {
                xCUpLoad = new CurUpLoad();
                if (xCLoad != null)
                {
                    xCUpLoad.xLP = xCLoad.xLP;
                }
                xDP = xCUpLoad.xLP;
            }
            xCUpLoad.ilUpLoad.SetAllAvail(true);
            xCUpLoad.ilUpLoad.CurReg = AppC.UPL_ALL;

            switch (nCom)
            {
            case AppC.COM_ZOPEN:
                sErr = "";
                foreach (object s in lbTTN.Items)
                {
                    sErr += (string)s + " ";
                }
                sSys = String.Format("AVT={4},MASSA={0},SUMMA={1},MEST={2},TTN={3}",
                                     xAvt.Massa, xAvt.Summa, xAvt.Mest, sErr, xAvt.Avto);
                dgL = new LoadFromSrv(AvtFromSrv);
                break;

            case AppC.COM_ZPL:
                dgL = new LoadFromSrv(InfoFromPL);
                break;

            case AppC.COM_ZCONTR:
                // по всем невыгруженным документам
                dv = new DataView(xNSI.DT[NSI.TBD_DOC].dt,
                                  String.Format("SOURCE={0}", NSI.DOCSRC_CRTD), "", DataViewRowState.CurrentRows);
                if (dv.Count <= 0)
                {
                    ServClass.ErrorMsg("Нет данных !");
                    return(AppC.RC_OK);
                }
                for (i = 0; i < dv.Count; i++)
                {
                    if (i > 0)
                    {
                        sSys += ",";
                    }
                    sSys += dv[i].Row["IDSER2D"].ToString();
                    aDR.Add(dv[i].Row);
                }
                xCUpLoad.sComPar = sSys;
                dgL = new LoadFromSrv(AvtFromSrv);

                break;
            }

            xFPan.ShowP(6, 60, "Запрос данных", xCUpLoad.ilUpLoad.CurRegName);
            xFPan.UpdateHelp("Обмен с сервером...");

            Cursor crsOld = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            sErr = ExchgSrv(nCom, sSys, "", dgL, null, ref nRet);

            Cursor.Current = crsOld;
            xFPan.HideP();

            if (nRet == AppC.RC_OK)
            {
            }
            else
            {
                MessageBox.Show("Результат - " + sErr, "Код - " + nRet.ToString());
            }


            if (tcMain.SelectedIndex != PG_DIR)
            {
                tcMain.SelectedIndex = PG_DIR;
            }

            switch (nCom)
            {
            case AppC.COM_ZPL:
                break;

            case AppC.COM_ZCONTR:
                for (i = 0; i < dv.Count; i++)
                {
                    //aDR[i]["SOURCE"] = NSI.DOCSRC_UPLD;
                }
                break;
            }



            return(nRet);
        }