// проверка склада private void tDefKSKL_Validating(object sender, CancelEventArgs e) { int nS = 0; if (tDefKSKL.Text.Trim().Length > 0) { try { nS = int.Parse(tDefKSKL.Text); NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_POST, new object[] { nS }, "NAME"); tDefNameSkl.Text = zS.sName; e.Cancel = !zS.bFind; } catch { e.Cancel = true; } } else { //DefDoc.nDefSklad = AppC.EMPTY_INT; } if ((true == e.Cancel) || (nS <= 0)) { tDefNameSkl.Text = ""; } }
private void tDefKSKL_Validating(object sender, CancelEventArgs e) { int nS = 0; string sS = tDefKSKL.Text.Trim(); if (sS.Length > 0) { try { nS = int.Parse(sS); if (nS > 0) { NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SKLAD, new object[] { nS }, "NAME"); e.Cancel = !zS.bFind; tDefNameSkl.Text = zS.sName; } } catch { e.Cancel = true; } } if (nS <= 0) { aEd.SetAvail(tDefUch, false); tDefUch.Text = ""; tDefNameUch.Text = ""; } else { aEd.SetAvail(tDefUch, IsUch(nS)); } //if (nCurReg != AppC.AVT_TOUT) // aEd.SetAvail(cbReg, ((nS == 1) || (nS == 8)) ? true : false); }
// проверка участка private void tDefUch_Validating(object sender, CancelEventArgs e) { int nS = int.Parse(tDefKSKL.Text), nU = 0; string sU = tDefUch.Text.Trim(); if (sU.Length > 0) { try { nU = int.Parse(sU); if (nU > 0) { NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SUSK, new object[] { nS, nU }, "NAME"); e.Cancel = !zS.bFind; tDefNameUch.Text = zS.sName; } } catch { e.Cancel = true; } } if (nU <= 0) { tDefUch.Text = "0"; tDefNameUch.Text = ""; } }
// проверка участка private void tKUch_p_Validating(object sender, CancelEventArgs e) { string sT = ((TextBox)sender).Text.Trim(); if (sT.Length > 0) { try { int nS = int.Parse(tKSkl_p.Text), nU = int.Parse(tKUch_p.Text); NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SUSK, new object[] { nS, nU }, "NAME"); if (zS.bFind == false) { e.Cancel = true; } else { xDP.nUch = nU; } } catch { e.Cancel = true; } } else { xDP.nUch = AppC.EMPTY_INT; } //if (e.Cancel != true) // e.Cancel = !ServClass.TryEditNextFiled((Control)sender, nCurEditCommand, aEdVvod); }
// проверка парол¤ дл¤ непустого пользовател¤ //public bool ValidUserPass(string sUser, string sPass, string sTabN, string sUN) //{ // bool ret = false; // int nRet = AppC.RC_OK; // if (sUser.Length > 0) // { // if ((sUser != AppC.SUSER) && (sUser != AppC.GUEST)) // { // try // { // if (sTabN.Length > 0) // {// отсканирован штрихкод с табельным // ret = true; // } // else // { // DataView dv = new DataView(xNSI.DT[NSI.NS_USER].dt, // String.Format("KP='{0}'", sUser), "", DataViewRowState.CurrentRows); // if (dv.Count == 1) // { // if (sPass == (string)dv[0].Row["PP"]) // { // ret = true; // sUN = (string)dv[0].Row["NMP"]; // sTabN = (string)dv[0].Row["TABN"]; // } // } // } // string sE = CheckUserLogin(sUser, sTabN, ref nRet); // if (nRet != AppC.RC_OK) // { // ret = false; // Srv.ErrorMsg(sE, true); // } // } // catch { } // } // else // { // ret = true; // sUN = (sUser == AppC.SUSER) ? "Admin" : "–аботник склада"; // } // if (ret) // { // xSm.sUser = sUser; // xSm.sUName = sUN; // xSm.sUserPass = sPass; // xSm.sUserTabNom = sTabN; // xSm.urCur = (sUser == AppC.SUSER) ? Smena.USERRIGHTS.USER_SUPER : // Smena.USERRIGHTS.USER_KLAD; // } // } // return (ret); //} // проверка парол¤ дл¤ непустого пользовател¤ private bool ValidUser() { bool ret = false; if (xSm.sUser.Length > 0) { if ((xSm.sUser != AppC.SUSER) && (xSm.sUser != AppC.GUEST)) { try { xSm.urCur = Smena.USERRIGHTS.USER_KLAD; NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_USER, new object[] { xSm.sUser }, "PP"); if (zS.bFind == true) { if (tPass.Text.Trim() == zS.sName) { ret = true; } } } catch { } } else { ret = true; xSm.urCur = (xSm.sUser == AppC.SUSER)?Smena.USERRIGHTS.USER_SUPER : Smena.USERRIGHTS.USER_KLAD; } } return(ret); }
// проверка участка private void tDefUch_Validating(object sender, CancelEventArgs e) { int nS = int.Parse(tDefKSKL.Text), nU = 0; string sU = tDefUch.Text.Trim(); if (sU.Length > 0) { try { nU = int.Parse(sU); if (nU > 0) { NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SUSK, new object[] { nS, nU }, "NAME"); e.Cancel = !zS.bFind; tDefNameUch.Text = zS.sName; } } catch { e.Cancel = true; } } if (nU <= 0) { tDefUch.Text = "0"; tDefNameUch.Text = ""; } //if (e.Cancel != true) // e.Cancel = !ServClass.TryEditNextFiled((Control)sender, nCurEditCommand, aEdVvod); }
// проверка смены private void tSm_p_Validating(object sender, CancelEventArgs e) { string sT = ((TextBox)sender).Text.Trim(); if (sT.Length > 0) { NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SMEN, new object[] { sT }, "NAME"); //02.05.11 !!! e.Cancel = !zS.bFind; } xDP.sSmena = sT; }
// проверка смены private void tSm_p_Validating(object sender, CancelEventArgs e) { string sT = ((TextBox)sender).Text.Trim(); if (sT.Length > 0) { NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SMEN, new object[] { sT }, "NAME"); //02.05.11 !!! e.Cancel = !zS.bFind; } xDP.sSmena = sT; //if (e.Cancel != true) // e.Cancel = !ServClass.TryEditNextFiled((Control)sender, nCurEditCommand, aEdVvod); }
// проверка экспедитора private void tKEks_p_Validating(object sender, CancelEventArgs e) { string sT = ((TextBox)sender).Text.Trim(); if (sT.Length > 0) { try { int nE = int.Parse(sT); if (xDP.TypOper != AppC.TYPOP_KMPL) { NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_EKS, new object[] { nE }, "FIO"); tNEks_p.Text = zS.sName; if (zS.bFind == false) { e.Cancel = true; } else { xDP.nEks = nE; xDP.sEks = zS.sName; } } else { xDP.nEks = nE; } } catch { e.Cancel = true; } } else { xDP.nEks = AppC.EMPTY_INT; xDP.sEks = ""; if (xDP.nTypD == AppC.TYPD_VPER) { //ServClass.ChangeEdArrDet(new Control[] { tNom_p }, new Control[] { tKEks_p }, aEdVvod); tNom_p.Enabled = true; tKEks_p.Enabled = false; } } //if (e.Cancel != true) // e.Cancel = !ServClass.TryEditNextFiled((Control)sender, nCurEditCommand, aEdVvod); }
// проверка имени пользовател¤ private void tUser_Validating(object sender, CancelEventArgs e) { if (bUserChanged == true) { string s = tUser.Text.Trim().ToUpper(); if (s.Length > 0) { if ((s == AppC.SUSER) || (s == AppC.GUEST)) {// пароль не нужен tUser.Text = (s == AppC.SUSER)?"Admin" : "—отрудник"; //ServClass.ChangeEdArrDet(null, new Control[] { tPass }, aEdVvod); aEdVvod.SetAvail(tPass, false); } else { try { //ServClass.ChangeEdArrDet(new Control[] { tPass }, null, aEdVvod); aEdVvod.SetAvail(tPass, true); NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_USER, new object[] { s }, "NMP"); if (zS.bFind == false) { e.Cancel = true; } else { tUser.Text = zS.sName; } } catch { e.Cancel = true; } } } if (e.Cancel != true) { xSm.sUser = s; xSm.sUName = tUser.Text; //e.Cancel = !ServClass.TryEditNextFiled((Control)sender, nCurEditCommand, aEdVvod); } } }
// тип документа все-таки сменился //private void tKT_p_Validated(object sender, EventArgs e) //{ // int i; // if (bEditMode) // { // if (xDP.nTypD == AppC.EMPTY_INT) // { // tKT_p.Text = ""; // tNT_p.Text = ""; // //e.Cancel = true; // //ServClass.TBColor((TextBox)sender, true); // //for (i = 0; i < aEdVvod.Count; i++) // //{ // // if (aEdVvod[i] != tKT_p) // // aEdVvod[i].Enabled = true; // //} // } // } //} // проверка склада private void tKSkl_p_Validating(object sender, CancelEventArgs e) { string sT = ((TextBox)sender).Text.Trim(); if (sT.Length > 0) { try { int nS = int.Parse(sT); NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SKLAD, new object[] { nS }, "NAME"); tNSkl_p.Text = zS.sName; if (zS.bFind == false) { e.Cancel = true; } else { xDP.nSklad = nS; xDP.sSklad = zS.sName; } } catch { e.Cancel = true; } } else { xDP.nSklad = AppC.EMPTY_INT; } //if (e.Cancel != true) //e.Cancel = !ServClass.TryEditNextFiled((Control)sender, nCurEditCommand, aEdVvod); //aEdVvod.TryNext(AppC.CC_NEXT); if ((true == e.Cancel) || (xDP.nSklad == AppC.EMPTY_INT)) { Srv.PlayMelody(W32.MB_3GONG_EXCLAM); xDP.sSklad = ""; xDP.nUch = AppC.EMPTY_INT; tKUch_p.Text = ""; } }
private void tDefKSKL_Validating(object sender, CancelEventArgs e) { bool bFindU = false; int nS = 0; string sS = tDefKSKL.Text.Trim(); if (sS.Length > 0) { try { nS = int.Parse(sS); if (nS > 0) { NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SKLAD, new object[] { nS }, "NAME"); e.Cancel = !zS.bFind; tDefNameSkl.Text = zS.sName; } } catch { e.Cancel = true; } //if (nS <= 0) //{ // if ((xNSI.DT[NSI.NS_SKLAD].nState == NSI.DT_STATE_READ) && (sS.Length > 0)) // e.Cancel = true; //} } else { xSm.nSklad = 0; } bFindU = IsUch(nS); aEd.SetAvail(tDefUch, bFindU); if (!bFindU) { tDefUch.Text = ""; tDefNameUch.Text = ""; } }
// проверка имени пользователя private void tUser_Validating(object sender, CancelEventArgs e) { if (bUserChanged == true) { string s = tUser.Text.Trim().ToUpper(); if (s.Length > 0) { if ((s == AppC.SUSER) || (s == AppC.GUEST)) {// пароль не нужен tUser.Text = (s == AppC.SUSER) ? "Admin" : "Работник склада"; aEd.SetAvail(tPass, false); } else { try { aEd.SetAvail(tPass, true); NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_USER, new object[] { s }, "NMP"); if (zS.bFind == false) { e.Cancel = true; } else { tUser.Text = zS.sName; } } catch { e.Cancel = true; } } } if (e.Cancel != true) { xSm.sUser = s; xSm.sUName = tUser.Text; } } }
// проверка склада private void tKSkl_p_Validating(object sender, CancelEventArgs e) { string sT = ((TextBox)sender).Text.Trim(); if (sT.Length > 0) { try { int nS = int.Parse(sT); NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SKLAD, new object[] { nS }, "NAME"); tNSkl_p.Text = zS.sName; if (zS.bFind == false) { e.Cancel = true; } else { xDP.nSklad = nS; xDP.sSklad = zS.sName; } } catch { e.Cancel = true; } } else { xDP.nSklad = AppC.EMPTY_INT; } if ((true == e.Cancel) || (xDP.nSklad == AppC.EMPTY_INT)) { Srv.PlayMelody(W32.MB_3GONG_EXCLAM); xDP.sSklad = ""; xDP.nUch = AppC.EMPTY_INT; tKUch_p.Text = ""; } }
/// подготовить и отобразить содержимое SSCC private void ShowSSCCContent(DataTable dtZ, string sSSCC, ServerExchange xSE, AddrInfo xA, ref Srv.CurrFuncKeyHandler ehKeybHdl) { const int NP_LEN = 5; int nTotMest, nM; string sNP, sUser = "", sFIO = ""; char cExCh = '='; DataRow xd; DateTime dVyr; List <string> lKMC = new List <string>(), lCur = new List <string>(); FRACT fTotEd, fE; nTotMest = 0; fTotEd = 0; try { string sA = ""; try { sA = xA.AddrShow; } catch { } try { sUser = xSE.AnswerPars["USER"]; if ((sUser == AppC.SUSER) || (sUser == AppC.GUEST)) { sFIO = (sUser == AppC.SUSER) ? "Admin" : "Работник склада"; } else { NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_USER, new object[] { sUser }, "NMP"); if (zS.bFind) { sFIO = sUser + '-' + zS.sName; } else { sFIO = sUser; } } } catch { sFIO = ""; } xInf = aKMCName(String.Format("{0} ({1}) {2}", sSSCC.Substring(2), sA, sFIO), false); xInf.Add(aKMCName("", true, cExCh)[0]); if (dtZ.Rows.Count > 0) { DataView dv = new DataView(dtZ, "", "KMC", DataViewRowState.CurrentRows); foreach (DataRowView dva in dv) { xd = dva.Row; try { nM = (int)xd["KOLM"]; } catch { nM = 0; } try { fE = (FRACT)xd["KOLE"]; } catch { fE = 0; } try { dVyr = DateTime.ParseExact((string)xd["DVR"], "yyyyMMdd", null); } catch { dVyr = DateTime.MinValue; } nTotMest += nM; fTotEd += fE; if (!lKMC.Contains((string)xd["KMC"])) { lKMC.Add((string)xd["KMC"]); } lCur.Add(String.Format("{0,4} {1}", xd["KRKMC"], xd["SNM"])); //lCur.Add(String.Format("{0} {1,6} {2,5:F1} {3,6} {4,7}", dVyr.ToString("dd.MM"), xd["NP"], xd["EMK"], nM, fE)); sNP = xd["NP"].ToString(); if (sNP.Length > NP_LEN) { sNP = sNP.Substring(sNP.Length - NP_LEN, NP_LEN); } else { sNP = sNP.PadLeft(NP_LEN); } lCur.Add(String.Format("{0} {1,5} {2,5:F1} {3,6} {4,7}", dVyr.ToString("dd.MM"), sNP, xd["EMK"], nM, fE)); lCur.Add(aKMCName("", true)[0]); } xInf.Add(String.Format("Всего SKU: {0} Мест:{1} Ед.:{2}", lKMC.Count, nTotMest, fTotEd)); xInf.Add(aKMCName("", true, cExCh)[0]); xInf.Add(" Двыр №пт Емк Мест Ед."); xInf.Add(aKMCName("", true, cExCh)[0]); xInf.AddRange(lCur); } else { xInf.Add("Нет сведений!"); Srv.PlayMelody(W32.MB_3GONG_EXCLAM); } //xHelpS.ShowInfo(xInf, ref ehKeybHdl); Srv.HelpShow xSSCCCont = new Srv.HelpShow(this); //xSSCCCont.ShowInfo(xInf, ref ehKeybHdl); xSSCCCont.ShowInfo(null, (tcMain.SelectedIndex == PG_DOC) ? dgDoc : (tcMain.SelectedIndex == PG_SCAN) ? dgDet : null, xInf, ref ehKeybHdl); } catch (Exception ex) { int ggg = 999; } }
// сброс/установка полей ввода/вывода private void SetParFields(DocPars xDP) { int n = xDP.nNumTypD; tNT_p.Text = TName(xDP.nNumTypD); if (tNT_p.Text.Length == 0) { tNT_p.Text = "<Неизвестный>"; tKT_p.Text = ""; xDP.nNumTypD = AppC.EMPTY_INT; } else { tKT_p.Text = xDP.nNumTypD.ToString(); } //xDP.sTypD = tNT_p.Text; tNom_p.Text = xDP.sNomDoc; tBCDoc.Text = xDP.sBC_Doc; tBCML.Text = xDP.sBC_ML; tDateD_p.Text = DateTime.Now.ToString("dd.MM.yy"); if (xDP.dDatDoc != DateTime.MinValue) { tDateD_p.Text = xDP.dDatDoc.ToString("dd.MM.yy"); } tKSkl_p.Text = ""; tNSkl_p.Text = ""; if (xDP.nSklad != AppC.EMPTY_INT) { tKSkl_p.Text = xDP.nSklad.ToString(); NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SKLAD, new object[] { xDP.nSklad }, "NAME"); if (zS.bFind == true) { tNSkl_p.Text = zS.sName; xDP.sSklad = zS.sName; } } //tKUch_p.Text = ""; //if ((xDP.nUch != AppC.EMPTY_INT) && (xDP.nUch != 0)) //{ // tKUch_p.Text = xDP.nUch.ToString(); //} //tSm_p.Text = xDP.sSmena; //tKEks_p.Text = ""; //tNEks_p.Text = ""; //if (xDP.nEks != AppC.EMPTY_INT) //{ // tKEks_p.Text = xDP.nEks.ToString(); // NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_EKS, new object[] { xDP.nEks }, "FIO"); // if (zS.bFind == true) // { // tNEks_p.Text = zS.sName; // xDP.sEks = zS.sName; // } //} //else // xDP.sEks = ""; //tKPol_p.Text = ""; //tNPol_p.Text = ""; //if (xDP.nPol != AppC.EMPTY_INT) //{ // tKPol_p.Text = xDP.nPol.ToString(); // if (xDP.nTypD == AppC.TYPD_RASHNKLD) // { // sIS = DocPars.OPRName(ref xDP.nPol); // } // else // { // NSI.RezSrch zS = xNSI.GetNameSPR((xDP.nTypD == AppC.TYPD_PERMGP ) ? // NSI.NS_SKLAD : NSI.NS_PP, new object[] { xDP.nPol }, "NAME"); // sIS = zS.sName; // } // tNPol_p.Text = sIS; // xDP.sPol = sIS; //} //else // xDP.sPol = ""; }
// сброс/установка полей ввода/вывода private void SetParFields(DocPars xDP) { int n = xDP.nTypD; string sIS; DocPars.tKTyp.Text = (n == AppC.EMPTY_INT) ? "" : xDP.nTypD.ToString(); sIS = DocPars.TypDName(n); DocPars.tNTyp.Text = (sIS.Length > 0) ? sIS : "<Неизвестный>"; xDP.sTypD = DocPars.tNTyp.Text; tSm_p.Text = xDP.sSmena; tDateD_p.Text = DateTime.Now.ToString("dd.MM.yy"); if (xDP.dDatDoc != DateTime.MinValue) { tDateD_p.Text = xDP.dDatDoc.ToString("dd.MM.yy"); } tKSkl_p.Text = ""; tNSkl_p.Text = ""; if (xDP.nSklad != AppC.EMPTY_INT) { tKSkl_p.Text = xDP.nSklad.ToString(); NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SKLAD, new object[] { xDP.nSklad }, "NAME"); if (zS.bFind == true) { tNSkl_p.Text = zS.sName; xDP.sSklad = zS.sName; } } tKUch_p.Text = ""; if ((xDP.nUch != AppC.EMPTY_INT) && (xDP.nUch != 0)) { tKUch_p.Text = xDP.nUch.ToString(); } tNom_p.Text = xDP.sNomDoc; tKEks_p.Text = ""; tNEks_p.Text = ""; if (xDP.nEks != AppC.EMPTY_INT) { tKEks_p.Text = xDP.nEks.ToString(); if (xDP.TypOper != AppC.TYPOP_KMPL) { NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_EKS, new object[] { xDP.nEks }, "FIO"); if (zS.bFind == true) { tNEks_p.Text = zS.sName; xDP.sEks = zS.sName; } } else { tNEks_p.Text = xDP.sEks; } } else { xDP.sEks = ""; } tKPol_p.Text = ""; tNPol_p.Text = ""; if (xDP.nPol != AppC.EMPTY_INT) { tKPol_p.Text = xDP.nPol.ToString(); if (xDP.nTypD == AppC.TYPD_OPR) { sIS = DocPars.OPRName(ref xDP.nPol); } else if (xDP.TypOper != AppC.TYPOP_KMPL) { NSI.RezSrch zS = xNSI.GetNameSPR((xDP.nTypD == AppC.TYPD_VPER) ? NSI.NS_SKLAD : NSI.NS_PP, new object[] { xDP.nPol }, "NAME"); sIS = zS.sName; } else { sIS = xDP.sPol; } tNPol_p.Text = sIS; xDP.sPol = sIS; } else { xDP.sPol = ""; } SetTime2Load(); }