//////////////////////////////////////////////////////////////// // Technomaint 2004 (c) SofTech di Germinara Francesco 2000,2004 // www.germinara.it info@germinara.it // Story: // //////////////////////////////////////////////////////////////// // Checked Version: 6/5/2004 //////////////////////////////////////////////////////////////// #include "stdafx.h" #include "CTechnomaint.h" //La Classe Applicazione extern CTechnomaintApp theApp; extern BOOL SMSOptFind(CStringArray& Opts,CString& option); //Defined in this module extern BOOL SMSOptFind(CString& Opts,CString& option); //Defined in this module extern CString getValueFromTemplate(CString strFieldNameField); //At this point User Table is positioned to valid user record //#VI CString VI(CStringArray& cmdParams,CStringArray& cmdOptions){ CString fit,strResult; int nParms=0; int nOpts=0; int sts=0; CString errStr; nParms=cmdParams.GetSize(); nOpts=cmdOptions.GetSize(); //Check Syntax if(nOpts!= 0){ errStr.Format("#VI: No options are allowed"); } if(nParms!=0){ errStr.Format("#VI: No parameters are allowed"); } if((nParms==0) && (nOpts==0) && errStr.IsEmpty()) { errStr=""; //AfxMessageBox("#VI: "); CString strSMSToSend; strSMSToSend="TechnoMaint - By da SofTech di Germinara Francesco www.germinara.it V.2.00 - 2004"; int sts=0; CString idUser; sts=theApp.m_pTabCfgInvioMsg->FindByNumber(theApp.m_SendResponseTO); if(sts==RC_SI) idUser=theApp.m_pTabCfgInvioMsg->m_addrmailto.TrimRight(); else idUser="----"; theApp.QueueSMSToSend(theApp.m_SendResponseTO,idUser,strSMSToSend); theApp.m_SendResponseTO=""; theApp.m_ParseMsgText=""; } return errStr; }; //#CM Chiamata di intervento #CM 1400 [F] F=FERMO CString CM(CStringArray& cmdParams,CStringArray& cmdOptions){ CString fit,strResult; int i=0; int nParms=0; int nOpts=0; CString errStr; CString strImpianto; CString strTipo; CString strFermo; CString strMotivo; CString strOpt; CString strSMSToSend; int sts=0; strTipo="00"; nParms=cmdParams.GetSize(); //Check Syntax if((nParms!= 1) && (nParms!= 2)){ errStr.Format("#CM: Invalid parameter number (%d). Must be 1 or 2.",nParms); } nOpts=cmdOptions.GetSize(); if(nOpts!= 0){ errStr.Format("#CM: Invalid option number (%d). Must be equal 0.",nOpts); } if(((nParms== 1) ||(nParms== 2))&& errStr.IsEmpty()) { // errStr=""; strImpianto=cmdParams.GetAt(0); strImpianto.TrimRight(); strFermo=""; if(nParms == 2) strFermo=cmdParams.GetAt(1); if(!strImpianto.IsEmpty()){ //Perform operation CTabRichInt tmpTabRichInt; CString prgrich; int sts=0; BOOL stsImp=true; CBseData bseData; CString strCdC; //Centro di costo CString strReparto; //Reparto bseData.Oggi(); bseData.SetDataAAAAMMGG(); sts=theApp.m_pTabSchedaImp->LoadDati(strImpianto,strTipo,theApp.bseInfo.m_stabilimento); if(sts==RC_SI){ //Controllo lo stato dell'impianto: Se "O" Obsoleto, non consento registrazione CString strStatoImp; strStatoImp=getValueFromTemplate(theApp.bseInfo.m_strEdtStatoImp); if(strStatoImp=="O"){ strSMSToSend="ERRORE: L'impianto indicato risulta essere OBSOLETO! Quindi, non è possibile inserire la chiamata\nVerificare il codice impianto o parlare con il responsabile del reparto.Grazie, per la collaborazione."; stsImp=false; } if(strStatoImp=="I"){ strSMSToSend="ERRORE: L'impianto indicato risulta essere INATTIVO! Quindi, non è possibile inserire la chiamata\nVerificare il codice impianto o parlare con il responsabile del reparto. Grazie, per la collaborazione."; stsImp=false; } if(stsImp){ strCdC=getValueFromTemplate(theApp.bseInfo.m_strEdtCdC); strReparto=getValueFromTemplate(theApp.bseInfo.m_strEdtReparto); tmpTabRichInt.m_data_rich=bseData.data; tmpTabRichInt.m_ora_rich=bseData.ora; tmpTabRichInt.m_codrep=strReparto; tmpTabRichInt.m_cdic=strCdC; tmpTabRichInt.m_codimp=strImpianto; tmpTabRichInt.m_tipo=strTipo; tmpTabRichInt.m_codprod=""; tmpTabRichInt.m_codtipoint_rich=""; tmpTabRichInt.m_descr="Intervento richiesto dal cellulare n. "+theApp.m_SendResponseTO; tmpTabRichInt.m_usrcode="@CEL"; tmpTabRichInt.m_tiporich="M"; tmpTabRichInt.m_priorita="1"; tmpTabRichInt.m_ggattesamax="1"; tmpTabRichInt.m_flgTx="0"; tmpTabRichInt.m_stato="E"; tmpTabRichInt.m_note=""; tmpTabRichInt.m_rich_risched=""; tmpTabRichInt.m_usrassegnata=""; tmpTabRichInt.m_stabilimento=theApp.bseInfo.m_stabilimento; tmpTabRichInt.m_gruppo=theApp.m_pTabSchedaImp->m_gruppo; tmpTabRichInt.m_tecnologia=theApp.m_pTabSchedaImp->m_tecnologia; if(strFermo=="F") tmpTabRichInt.m_flgmaccferma="1"; else tmpTabRichInt.m_flgmaccferma="0"; theApp.m_pTabRichInt->InsertNewProg(prgrich,tmpTabRichInt); //AfxMessageBox("#CM: Impianto"+strImpianto+" Fermo: "+strFermo); strSMSToSend="OK, E' stata generata la richiesta N. "+prgrich; } }else strSMSToSend="Codice Impianto Non esistente! Richiesta NON ACCETTATA!"; if(strSMSToSend.GetLength()>160) strSMSToSend=strSMSToSend.Mid(0,160); CString idUser; sts=theApp.m_pTabCfgInvioMsg->FindByNumber(theApp.m_SendResponseTO); if(sts==RC_SI) idUser=theApp.m_pTabCfgInvioMsg->m_addrmailto.TrimRight(); else idUser="----"; theApp.QueueSMSToSend(theApp.m_SendResponseTO,idUser,strSMSToSend); theApp.m_SendResponseTO=""; //IMPORTANTE: Ripulire x evitare nuovi invii theApp.m_ParseMsgText=""; } } return errStr; }; //Note: Use "value" for check numeric option if found, the value is in put in option argument BOOL SMSOptFind(CStringArray& Opts,CString& option){ int nIndex=0; CString tmpOpt; for(nIndex=0; nIndex < Opts.GetSize(); nIndex++){ tmpOpt=Opts.GetAt(nIndex); if(option=="value") if(atoi(tmpOpt)>0) return TRUE; if(tmpOpt.Find(option)>=0) return TRUE; } return FALSE; } //Note: Use "value" for check numeric option if found, the value is in put in option argument BOOL SMSOptFind(CString& Opts,CString& option){ CString tmpOpt; tmpOpt=Opts; if(option=="value") if(atoi(tmpOpt)>0) return TRUE; if(tmpOpt.Find(option)>=0) return TRUE; return FALSE; } //Fine