Example #1
0
    def insertVacationDate(self, date):

        dt = StringOperation.toString((datetime.strptime(date + ' 00:00:00', '%Y-%m-%d %H:%M:%S') - relativedelta(months=1)).date())

        dao = VacationDateDao(self.db)

        dao.addWhereStr(VacationDateDao.COL_GIVE_DATE, dt, dao.COMP_GREATER_EQUAL)
        dao.addWhereStr(VacationDateDao.COL_GIVE_DATE, date, dao.COMP_LESS)

        select = dao.doSelect()
        count = 0

        for i in range(len(select)):
            employeeId = select[i][VacationDateDao.COL_EMPLOYEE_ID]
            giveDate = StringOperation.toString((datetime.strptime(str(select[i][VacationDateDao.COL_GIVE_DATE]) + ' 00:00:00', '%Y-%m-%d %H:%M:%S') + relativedelta(years=1)).date())
            workYear = select[i][VacationDateDao.COL_WORK_YEAR]
            if workYear < 7:
                workYear += 1
            dao = VacationDateDao(self.db)
            dao.addColVal(VacationDateDao.COL_EMPLOYEE_ID, employeeId)
            dao.addColValStr(VacationDateDao.COL_GIVE_DATE, giveDate)
            dao.addColVal(VacationDateDao.COL_WORK_YEAR, workYear)
            dao.doInsert()
            count+=1

        self.writeLog('有休付与情報追加件数:' + StringOperation.toString(count) + '件')

        return
Example #2
0
 def __init__(self):
     self.appId = self.getAppId()
     self.appName = self.getAppName()
     self.procLogFileName = self.appId + "_" + StringOperation.toString(
         datetime.now().strftime("%Y-%m-%d")) + self.logExt
     self.errLogFileName = self.appId + "_" + StringOperation.toString(
         datetime.now().strftime("%Y-%m-%d")) + "_Err" + self.logExt
Example #3
0
    def mainProc(self, args):

        try:
            '''
            実行引数を受け取る
            '''
            for num in range(len(args)):
                if num > 0:
                    if args[num][0] == '-':
                        key = args[num]
                        value = args[num + 1]
                        self.form[key] = value
            '''
            confファイルを読み込み
            '''
            Config.confLoad('system')
            '''
            ロガーオープン
            '''
            self.logger = BaseLogger(self.procLogFileName)
            self.logger.fileOpen()
            self.logger.writeLog("START_TIME=" + StringOperation.toString(
                datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
            self.logger.writeLog("START_BATCH_NAME=" + self.appName)
            self.logger.writeLog("PARAM_INFO=" + self.appId + " param:" +
                                 " ".join(args))
            '''
            DB接続
            '''
            self.db = DbManager()
            self.db.connect()
            '''
            ロジック実行
            '''
            logic = self.getLogic(self.db, self.logger, self.form)
            logic.run()
        except Exception as e:
            self.errProc(e)

        finally:
            self.db.disConnect()
            self.logger.writeLog("END_TIME=" + StringOperation.toString(
                datetime.now().strftime("%Y-%m-%d %H:%M:%S")) + '\r\n')
            self.logger.fileClose()
Example #4
0
    def deleteData(self, ids):
        #資格手当情報
        dao = QualificationAllowanceDao(self.db)

        dao.addWhereIn(QualificationAllowanceDao.COL_EMPLOYEE_ID, ids)

        count = dao.doCount()

        self.writeLog('資格手当情報削除対象件数:' + StringOperation.toString(count) + '件')
        dao.doDelete()

        #有休付与情報
        dao = VacationDateDao(self.db)

        dao.addWhereIn(VacationDateDao.COL_EMPLOYEE_ID, ids)

        count = dao.doCount()

        self.writeLog('有休付与情報削除対象件数:' + StringOperation.toString(count) + '件')
        dao.doDelete()

        #雇用形態情報
        dao = EmployeeStatusDao(self.db)

        dao.addWhereIn(EmployeeStatusDao.COL_EMPLOYEE_ID, ids)

        count = dao.doCount()

        self.writeLog('雇用形態情報削除対象件数:' + StringOperation.toString(count) + '件')
        dao.doDelete()

        #社員情報
        dao = EmployeeDao(self.db)

        dao.addWhereIn(EmployeeDao.COL_ID, ids)

        count = dao.doCount()

        self.writeLog('社員情報削除対象件数:' + StringOperation.toString(count) + '件')
        dao.doDelete()

        return
Example #5
0
    def makeUpdateStatement(self):
        sql = 'UPDATE ' + self.table + ' SET '

        keys = list(self.colValMap.keys())
        for i in range(len(keys)):
            if i > 0:
                sql += ', '
            sql += keys[i] + self.COMP_EQUAL + StringOperation.toString(
                self.colValMap[keys[i]])

        return sql
Example #6
0
    def makeInsertStatement(self):
        sql = 'INSERT INTO ' + self.table + '('

        keys = list(self.colValMap.keys())
        for i in range(len(keys)):
            if i > 0:
                sql += ', '
            sql += keys[i]

        sql += ') VALUES ('

        values = list(self.colValMap.values())
        for i in range(len(values)):
            if i > 0:
                sql += ', '
            sql += StringOperation.toString(values[i])

        sql += ');'

        return sql
Example #7
0
 def setErrMailText(self, appName, e):
     msg = appName + u'にてシステムエラーが発生しました。\r\n\r\n'
     msg += StringOperation.toString(e)
     self.mailText = msg
Example #8
0
 def writeErrLog(self, e):
     self.file.write(StringOperation.toString(e) + '\r\n')
Example #9
0
    def getStandardDate(self, dt):
        date = dt + ' 00:00:00'
        bdt = datetime.strptime(date, '%Y-%m-%d %H:%M:%S')

        #文字列で返す
        return StringOperation.toString((bdt - relativedelta(months=6)).date())