コード例 #1
0
def execMailEMPSales(strJobPathRES, strDataDate):
    strEDIConnection = "3DW-DWuser@tpe-centos7-maria10-dw"
    strEDIDB = "DMMDL"

    listEMPSales = getEMPSalesList(strEDIConnection, strEDIDB, strDataDate)

    if execWriteWorkbook(strJobPathRES, listEMPSales) == True:
        strMessageSMTPServer = "tw-mail02.want-want.com"
        strMessageSMTPFrom = "*****@*****.**"
        arrayMessageSMTPTo = [
            "*****@*****.**", "*****@*****.**",
            "*****@*****.**", "*****@*****.**",
            "*****@*****.**", "*****@*****.**",
            "*****@*****.**", "*****@*****.**",
            "*****@*****.**", "*****@*****.**",
            "*****@*****.**"
        ]
        strMessageSubject = "业务人员花名册-%s" % strDataDate
        strAttachFileName = "业务人员花名册-%s.xlsx" % strDataDate

        Message.sendSMTPMail(strMessageSMTPServer, strMessageSMTPFrom,
                             arrayMessageSMTPTo, strMessageSubject, "",
                             strJobPathRES, strAttachFileName)
        return True
    else:
        return False
コード例 #2
0
def execMailInvalidRPT01(strJobPathRES, strEDINo, strDataDate):
    strEDIConnection = "3DW-DWuser@tpe-centos7-maria10-dw"
    strEDIDB = "DMMDL"

    listInvalidRPT01 = getInvalidRPT01List(strEDIConnection, strEDIDB, strEDINo)
    listInvalidRPT01ProdPos = getInvalidRPT01ProdPosList(strEDIConnection, strEDIDB)
    listInvalidRPT01ProdInv = getInvalidRPT01ProdInvList(strEDIConnection, strEDIDB)
    listInvalidRPT01StorePos = getInvalidRPT01StorePosList(strEDIConnection, strEDIDB)
    listInvalidRPT01StoreInv = getInvalidRPT01StoreInvList(strEDIConnection, strEDIDB)
    listInvalidRPT01StoreComPos = getInvalidRPT01StoreComPosList(strEDIConnection, strEDIDB)
    listInvalidRPT01StoreComInv = getInvalidRPT01StoreComInvList(strEDIConnection, strEDIDB)
    listInvalidRPT01WHComInv = getInvalidRPT01WHComInvList(strEDIConnection, strEDIDB)

    if execWriteWorkbook(strJobPathRES, listInvalidRPT01, \
                         listInvalidRPT01ProdPos, listInvalidRPT01ProdInv, listInvalidRPT01StorePos, listInvalidRPT01StoreInv, \
                         listInvalidRPT01StoreComPos, listInvalidRPT01StoreComInv, listInvalidRPT01WHComInv) == True:
        strMessageSMTPServer = "tw-mail02.want-want.com"
        strMessageSMTPFrom = "*****@*****.**"
        arrayMessageSMTPTo = [
            "*****@*****.**",
            "*****@*****.**",
            "*****@*****.**",
            "*****@*****.**"
        ]
        strMessageSubject = "现渠自动化管理平台-异常销售及库存数据清单-" + listInvalidRPT01[0]["POS_DATE_MIN"] + "-" + listInvalidRPT01[0]["POS_DATE_MAX"]
        strAttachFileName = "现渠自动化管理平台-异常销售及库存数据清单-" + listInvalidRPT01[0]["POS_DATE_MIN"] + "-" + listInvalidRPT01[0]["POS_DATE_MAX"] + ".xlsx"

        Message.sendSMTPMail(strMessageSMTPServer, strMessageSMTPFrom, arrayMessageSMTPTo, strMessageSubject, "", strJobPathRES, strAttachFileName)
        return True
    else:
        return False
コード例 #3
0
def main():
    strLoggerName = sys.argv[1]

    strEDIConnection = sys.argv[2]
    strEDIDB = sys.argv[3]
    strEDINo = sys.argv[4]
    strJobPathRES = sys.argv[5]
    strDependOnJobPathRES = sys.argv[6]

    # logger = logging.getLogger(strLoggerName)
    # logger.info(str(sys.argv))

    dictFlow = EDIEntity.getFlow(strEDIConnection, strEDIDB, strEDINo)
    strDataDate = dictFlow["DATA_DATE"]

    strMessageSMTPServer = "tw-mail02.want-want.com"
    strMessageSMTPFrom = "*****@*****.**"
    arrayMessageSMTPTo = ["*****@*****.**", "*****@*****.**"]
    strMessageSubject = "[测试] 业务人员花名册-%s" % strDataDate
    strAttachFileName = "[测试] 业务人员花名册-%s.xls" % strDataDate

    arrayColumnTitle = [
        "员工号",
        "姓名",
        "人事范围",
        "人事子范围",
        "雇佣日期",
        "部门名称",
        "三级部门",
        "四级部门",
        "五级部门",
        "六级部门",
        "七级部门",
        "八级部门",
        "职位代码",
        "职位",
        "职位属性",
        "职位类型",
        "职位区域注记",
        "职位注记",
        "职务",
        "职等",
        "性别",
        "年资",
    ]

    with open(strDependOnJobPathRES, "r",
              encoding="utf-8-sig") as fileOriginal:
        objData = fileOriginal.read()

    with open(strJobPathRES, "w", encoding="utf-8-sig") as fileTarget:
        fileTarget.write(",".join(arrayColumnTitle) + "\n" + objData)

    Message.sendSMTPMail(strMessageSMTPServer, strMessageSMTPFrom,
                         arrayMessageSMTPTo, strMessageSubject, "",
                         strJobPathRES, strAttachFileName)
コード例 #4
0
def execMailServerNotice():
    strMessageSMTPServer = "tw-mail02.want-want.com"
    strMessageSMTPFrom = "*****@*****.**"
    arrayMessageSMTPTo = [
        "*****@*****.**", "*****@*****.**"
    ]
    strMessageSubject = "!!!!! Connect to tw-mail02.want-want.com Success !!!!!"

    Message.sendSMTPMail(strMessageSMTPServer, strMessageSMTPFrom,
                         arrayMessageSMTPTo, strMessageSubject, "", None, None)
    return True
コード例 #5
0
def main():
    strEDIName = File.getCurrentFileName(__file__)
    strEDIPath = os.getcwd()

    jsonEDIService = Common.loadJsonFile(strEDIName + ".json")
    strEDIID = jsonEDIService["id"]

    strEDIConnection = Common.filterJsonListFirst(jsonEDIService["connectionList"], "connectionID", "maria-dw-DWuser-DWWANT")["connection"]
    strEDIDB = Common.filterJsonListFirst(jsonEDIService["connectionList"], "connectionID", "maria-dw-DWuser-DWWANT")["db"]

    intIntervalSeconds = jsonEDIService["intervalSeconds"]
    intFileBlockSize = jsonEDIService["fileBlockSize"]

    strMessageSMTPServer = jsonEDIService["messageSMTPServer"]
    strMessageSMTPFrom = jsonEDIService["messageSMTPFrom"]
    arrayMessageSMTPSuccessTo = jsonEDIService["messageSMTPSuccessToList"]
    arrayMessageSMTPFailureTo = jsonEDIService["messageSMTPFailureToList"]

    strLogDate = Common.setLogging(strEDIID)
    logger = logging.getLogger(strEDIID)

    logger.info("Load EDIFlows.json file.")
    jsonEDIFlows = Common.loadJsonFile(strEDIName + "Flows.json")

    try:

        logger.warning("Start EDI Service.")
        while True:
            strNowDate = Common.getDateSimple(datetime.datetime.now())
            if strNowDate != strLogDate:
                strLogDate = Common.setLogging(strEDIID)
                logger = logging.getLogger(strEDIID)

            EDIBase.validateSchedule(strEDIConnection, strEDIDB, jsonEDIFlows, intIntervalSeconds)
            EDIBase.executeWaitingFlows(strEDIPath, strEDIConnection, strEDIDB, jsonEDIFlows, 
                intFileBlockSize, strMessageSMTPServer, strMessageSMTPFrom, arrayMessageSMTPSuccessTo, arrayMessageSMTPFailureTo)
            EDIBase.deleteFlowLog(jsonEDIFlows)

            time.sleep(intIntervalSeconds)

    except Exception:
        strExceptionMessage = traceback.format_exc()
        logger.error(strExceptionMessage)

        strMessageSMTPSubject = "!!!!! {ediID} Exception !!!!!".format(ediID=strEDIID)
        Message.sendSMTPMail(strMessageSMTPServer, strMessageSMTPFrom, arrayMessageSMTPFailureTo, strMessageSMTPSubject, strExceptionMessage, None, None)
        
        logger.error("Stop EDI Service by Exception.")
    finally:
        logger.warning("Stop EDI Service.")
コード例 #6
0
    def getID(self, place):
        node = self.world

        for i in range(len(place)):
            if (place[i] in node.children):
                node = node.children[place[i]]
            else:
                Message().invalidPlaceError(place)

        return [node.startID, node.endID]
コード例 #7
0
def execMailCustStmt(strJobPathRES, strDataDate):
    strEDIConnection = "3DW-DWuser@tpe-centos7-maria10-dw"
    strEDIDB = "DMMDL"

    listCustStmt = getCustStmtList(strEDIConnection, strEDIDB, strDataDate)

    if execWriteWorkbook(strJobPathRES, listCustStmt) == True:
        strMessageSMTPServer = "tw-mail02.want-want.com"
        strMessageSMTPFrom = "*****@*****.**"
        arrayMessageSMTPTo = [
            "*****@*****.**", "*****@*****.**",
            "*****@*****.**"
        ]
        strMessageSubject = "[测试]批发客户账余报表-%s" % strDataDate
        strAttachFileName = "[测试]批发客户账余报表-%s.xlsx" % strDataDate

        Message.sendSMTPMail(strMessageSMTPServer, strMessageSMTPFrom,
                             arrayMessageSMTPTo, strMessageSubject, "",
                             strJobPathRES, strAttachFileName)
        return True
    else:
        return False
コード例 #8
0
def execMailPOSRPT01(strJobPathRES, strDataDate):
    strEDIConnection = "3DW-DWuser@tpe-centos7-maria10-dw"
    strEDIDB = "DMMDL"

    listPOSRPT01 = getPOSRPT01List(strEDIConnection, strEDIDB, strDataDate)

    if listPOSRPT01[0]["POS_DATE"] == listPOSRPT01[0]["WEEK_LAST_DATE"]:

        listWeekNum = getWeekNumList(strEDIConnection, strEDIDB, strDataDate)
        listPOSRPT01System = getPOSRPT01SystemList(strEDIConnection, strEDIDB, strDataDate)
        listPOSRPT01SystemPCS = getPOSRPT01SystemPCSList(strEDIConnection, strEDIDB, strDataDate)
        listPOSRPT01SystemSKU = getPOSRPT01SystemSKUList(strEDIConnection, strEDIDB, strDataDate)
        listPOSRPT01ProdH1PCS = getPOSRPT01ProdH1PCSList(strEDIConnection, strEDIDB, strDataDate)
        listPOSRPT01ProdH1SKU = getPOSRPT01ProdH1SKUList(strEDIConnection, strEDIDB, strDataDate)
        
        if execWriteWorkbook(strJobPathRES, listWeekNum, listPOSRPT01, listPOSRPT01System, listPOSRPT01SystemPCS, listPOSRPT01SystemSKU, listPOSRPT01ProdH1PCS, listPOSRPT01ProdH1SKU) == True:
            strMessageSMTPServer = "tw-mail02.want-want.com"
            strMessageSMTPFrom = "*****@*****.**"

            for dictPOSRPT01System in listPOSRPT01System:
                strMessageSubject = dictPOSRPT01System["KA_SYSTEM_NM"] + "-现代渠道发展营业部业绩-通路系统品类周别POS推移-" + listPOSRPT01[0]["POS_DATE"]
                strContent = "尊敬的长官:早上好!\n敬请查阅:截止" + listPOSRPT01[0]["POS_DATE"][4:6] + "月" + listPOSRPT01[0]["POS_DATE"][-2:] + "日【" + dictPOSRPT01System["KA_SYSTEM_NM"] + "-现代渠道发展营业部业绩-通路系统品类周别POS推移报表】\n\n"
                strAttachFilePath = strJobPathRES.replace(".dat", "-" + dictPOSRPT01System["KA_SYSTEM_CODE"] + ".dat")
                strAttachFileName = dictPOSRPT01System["KA_SYSTEM_NM"] + "-现代渠道发展营业部业绩-通路系统品类周别POS推移-" + listPOSRPT01[0]["POS_DATE"] + ".xlsx"

                if dictPOSRPT01System["KA_SYSTEM_CODE"] == "H002":
                    #  H002 大润发 : 成骏 / 郭丹丹
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H005":
                    #  H005 麦德龙 : 左晓云 / 成骏 / 崔建辉
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H007":
                    #  H007 人人乐 : 郭鹏 / 宋涛
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H009":
                    #  H009 世纪联华 : 郭鹏 / 成骏 / 宋涛
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H010":
                    #  H010 沃尔玛 : 郭鹏 / 王勇 / 成骏
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H011":
                    #  H011 物美 : 陈寿明 / 胡雪斌 / 黄华 / 王珑 / 鲍冠杰
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H013":
                    #  H013 易初莲花 : 左晓云 / 成骏 / 崔建辉
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H016":
                    #  H016 丹尼斯 : 黄艳丽
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H017":
                    #  H017 天虹 : 章丽萍 / 张健 / 何丽琴
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H018":
                    #  H018 华润万家 : 郭鹏 / 高贺 / 成骏
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H021":
                    #  H021 美特好 : 杨文卿
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H042":
                    #  H042 百佳华 : 王从阳 / 雷艳红 / 何丽琴
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "H060":
                    #  H060 北国系统 : 艾贵银
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S001":
                    #  S001 农工商 : 郭鹏 / 成骏
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S004":
                    #  S004 上海联华 : 郭鹏 / 成骏 / 宋涛
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S006":
                    #  S006 苏果 : 杨斯竣 / 成骏
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S009":
                    #  S009 中百便民 : 王宁
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S010":
                    #  S010 中百仓储 : 王宁
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S011":
                    #  S011 中商 : 王宁
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S014":
                    #  S014 永辉 : 徐俊 / 张利霞 / 成骏
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S018":
                    #  S018 武商 : 王宁
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S020":
                    #  S020 威海糖酒 : 陈寿明 / 徐瑞虎
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S026":
                    #  S026 新世纪 : 刘爱民
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S030":
                    #  S030 红旗连锁 : 向君
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S031":
                    #  S031 银座 : 陈寿明 / 黄艳丽 / 徐瑞虎 / 王冰冰
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S044":
                    #  S044 北京华冠 : 陈寿明
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S052":
                    #  S052 步步高 : 张健
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S063":
                    #  S063 新华都 : 朱巧燕
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S110":
                    #  S110 联华华商 : 胡雪斌 / 鲍冠杰
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S151":
                    #  S151 华联系统 : 王冰冰
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S219":
                    #  S219 介休吉隆斯 : 杨文卿
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                elif dictPOSRPT01System["KA_SYSTEM_CODE"] == "S284":
                    #  S284 重客隆 : 刘爱民
                    arrayMessageSMTPTo = [ "*****@*****.**", "*****@*****.**" ]
                else:
                    arrayMessageSMTPTo = [ "*****@*****.**" ]

                Message.sendSMTPMail(strMessageSMTPServer, strMessageSMTPFrom, arrayMessageSMTPTo, strMessageSubject, strContent, strAttachFilePath, strAttachFileName)

            return True
        else:
            return False
    else:
        return False
コード例 #9
0
def execMailStoreMatlD(strLoggerName, strJobPathRES, strDataDate):
    strEDIConnection = "3DW-DWuser@tpe-centos7-maria10-dw"
    strEDIDB = "DMMDL"

    listStoreMatlD = getStoreMatlDList(strEDIConnection, strEDIDB, strDataDate)
    listStoreMatlDSystem = getStoreMatlDSystemList(strEDIConnection, strEDIDB,
                                                   strDataDate)

    if execWriteWorkbook(strJobPathRES, listStoreMatlD) == True:
        strMessageSMTPServer = "tw-mail02.want-want.com"
        strMessageSMTPFrom = "*****@*****.**"

        for dictStoreMatlDSystem in listStoreMatlDSystem:
            strMessageSubject = dictStoreMatlDSystem[
                "KA_SYSTEM_NM"] + "-现渠自动化管理平台-门店品项销售库存数据-日结算报表-" + dictStoreMatlDSystem[
                    "POS_INV_DATE"]
            strAttachFilePath = strJobPathRES.replace(
                ".dat", "-" + dictStoreMatlDSystem["KA_SYSTEM_CODE"] + ".dat")
            strAttachFileName = dictStoreMatlDSystem[
                "KA_SYSTEM_NM"] + "-现渠自动化管理平台-门店品项销售库存数据-日结算报表-" + dictStoreMatlDSystem[
                    "POS_INV_DATE"] + ".xlsx"

            if dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H002":
                #  量贩 H002 大润发 : 成骏 / 郭丹丹 / 朱晓菁
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H005":
                #  量贩 H005 麦德龙 : 左晓云 / 成骏 / 崔建辉 / 朱晓菁
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H007":
                #  标超 H007 人人乐 : 郭鹏 / 宋涛 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H009":
                #  标超 H009 世纪联华 : 郭鹏 / 成骏 / 宋涛 / 朱晓菁
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H010":
                #  量贩 H010 沃尔玛 : 郭鹏 / 王勇 / 成骏 / 张懿晴
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H011":
                #  标超 H011 物美 : 陈寿明 / 胡雪斌 / 黄华 / 王珑 / 鲍冠杰 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H013":
                #  量贩 H013 易初莲花 : 左晓云 / 成骏 / 崔建辉 / 许曣
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H016":
                #  标超 H016 丹尼斯 : 黄艳丽 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H017":
                #  标超 H017 天虹 : 王从阳 / 章丽萍 / 张健 / 何丽琴 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H018":
                #  标超 H018 华润万家 : 郭鹏 / 高贺 / 成骏 / 张懿晴
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H021":
                #  标超 H021 美特好 : 杨文卿 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H042":
                #  标超 H042 百佳华 : 王从阳 / 雷艳红 / 何丽琴 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "H060":
                #  标超 H060 北国系统 : 艾贵银 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S001":
                #  标超 S001 农工商 : 郭鹏 / 成骏 / 张懿晴
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S004":
                #  标超 S004 上海联华 : 郭鹏 / 成骏 / 宋涛 / 朱晓菁
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S006":
                #  标超 S006 苏果 : 杨斯竣 / 成骏 / 朱晓菁
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S009":
                #  便利 S009 中百便民 : 王宁 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S010":
                #  标超 S010 中百仓储 : 王宁 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S011":
                #  标超 S011 中商 : 王宁 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S014":
                #  标超 S014 永辉 : 徐俊 / 张利霞 / 成骏 / 许曣
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S018":
                #  标超 S018 武商 : 王宁 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S020":
                #  标超 S020 威海糖酒 : 陈寿明 / 徐瑞虎 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S026":
                #  标超 S026 新世纪 : 刘爱民 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S030":
                #  便利 S030 红旗连锁 : 向君 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S031":
                #  标超 S031 银座 : 陈寿明 / 黄艳丽 / 徐瑞虎 / 王冰冰 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S044":
                #  标超 S044 北京华冠 : 陈寿明 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S052":
                #  标超 S052 步步高 : 张健 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S063":
                #  标超 S063 新华都 : 朱巧燕 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S110":
                #  标超 S110 联华华商 : 胡雪斌 / 鲍冠杰 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**", "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S151":
                #  标超 S151 华联系统 : 王冰冰 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S219":
                #  标超 S219 介休吉隆斯 : 杨文卿 / 杨露露
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**",
                    "*****@*****.**"
                ]
            elif dictStoreMatlDSystem["KA_SYSTEM_CODE"] == "S284":
                #  标超 S284 重客隆 : 刘爱民
                arrayMessageSMTPTo = [
                    "*****@*****.**", "*****@*****.**"
                ]
            else:
                arrayMessageSMTPTo = ["*****@*****.**"]

            if (os.stat(strAttachFilePath).st_size / 1024 / 1024) > 7:
                strContent = "尊敬的长官:早上好!\n" + \
                    "敬请查阅:截止" + dictStoreMatlDSystem["POS_INV_DATE"][4:6] + "月" + dictStoreMatlDSystem["POS_INV_DATE"][-2:] + "日【" + dictStoreMatlDSystem["KA_SYSTEM_NM"] + "-门店品项销售库存数据-日结算报表】\n\n" + \
                    "注意!此档案有多个压缩包,请将压缩包置于同一位置后,在.zip压缩文档上点选二下執行解压缩,即可取得EXCEL文档。\n\n"

                strAttachDirPath = os.path.dirname(strAttachFilePath)
                strExcelFilePath = os.path.join(strAttachDirPath,
                                                strAttachFileName)
                strZipFileName = dictStoreMatlDSystem[
                    "KA_SYSTEM_NM"] + "-现渠自动化管理平台-门店品项销售库存数据-日结算报表-" + dictStoreMatlDSystem[
                        "POS_INV_DATE"]
                strZipFilePath = os.path.join(strAttachDirPath, strZipFileName)

                os.rename(strAttachFilePath, strExcelFilePath)

                strCommand = "zip -s 5m -j " + strZipFilePath + " " + strExcelFilePath
                tupleOutput = subprocess.Popen(
                    strCommand, shell=True,
                    stderr=subprocess.PIPE).communicate()
                strErrorOutput = tupleOutput[1].decode('utf-8')
                if strErrorOutput != "":
                    logger = logging.getLogger(strLoggerName)
                    logger.error(strErrorOutput)
                else:
                    for strFileName in os.listdir(strAttachDirPath):
                        if strFileName.startswith(
                                strZipFileName
                        ) == True and strFileName.endswith(".xlsx") == False:
                            Message.sendSMTPMail(
                                strMessageSMTPServer, strMessageSMTPFrom,
                                arrayMessageSMTPTo, strMessageSubject,
                                strContent,
                                os.path.join(strAttachDirPath,
                                             strFileName), strFileName)

                os.rename(strExcelFilePath, strAttachFilePath)
            else:
                strContent = "尊敬的长官:早上好!\n" + \
                    "敬请查阅:截止" + dictStoreMatlDSystem["POS_INV_DATE"][4:6] + "月" + dictStoreMatlDSystem["POS_INV_DATE"][-2:] + "日【" + dictStoreMatlDSystem["KA_SYSTEM_NM"] + "-门店品项销售库存数据-日结算报表】\n\n"
                Message.sendSMTPMail(strMessageSMTPServer, strMessageSMTPFrom,
                                     arrayMessageSMTPTo, strMessageSubject,
                                     strContent, strAttachFilePath,
                                     strAttachFileName)

        return True
    else:
        return False
コード例 #10
0
 def __init__(self):
     self.inputFormatter = InputFormatter()
     self.worldTree = WorldTree()
     self.message = Message()
コード例 #11
0
class Permission:
    def __init__(self):
        self.inputFormatter = InputFormatter()
        self.worldTree = WorldTree()
        self.message = Message()

    def findIDValue(self, place):
        place = place.split('-')
        place = place[::-1]
        return self.worldTree.getID(place)

    def checkPermission(self, lines, startIndex, endIndex, distributors):
        for i in range(startIndex, endIndex + 1):
            currentLine = lines[i].split(' ')
            distributorName, place = currentLine[0], currentLine[1]

            if (distributorName not in distributors):
                print(
                    colored(
                        "Distributor " + str(distributorName) +
                        " doesn't exist", 'red'))
                continue

            distributorNode = distributors[distributorName]
            startID, endID = self.findIDValue(place)
            isPresentInInclude = distributorNode.includes.isInRange(
                distributorNode.includes.root, startID, endID)
            isPresentInExclude = distributorNode.checkExcludes(
                distributorNode, startID, endID)

            if (isPresentInInclude and not (isPresentInExclude)):
                print(
                    colored(
                        "Yes, " + str(distributorName) +
                        " doesn't have permission to access " + str(place) +
                        " region", 'green'))
            else:
                print(
                    colored(
                        "No, " + str(distributorName) +
                        " doesn't have permission to access " + str(place) +
                        " region", 'blue'))

    def addPermissions(self, lines, startIndex, distributorNode,
                       parentDistributorNode):
        while (lines[startIndex] != ''):
            permission = lines[startIndex]
            permissionType, place = self.inputFormatter.processPermission(
                permission)
            place = place.strip()
            startID, endID = self.findIDValue(place)

            if (permissionType == "INCLUDE"):
                status = distributorNode.addIncludePermission(
                    startID, endID, parentDistributorNode)
                if (status):
                    self.message.includeExcludeSuccess(
                        lines[startIndex], distributorNode.distributorName)
                else:
                    self.message.includeWarning(
                        lines[startIndex], distributorNode.distributorName)

            if (permissionType == "EXCLUDE"):
                status = distributorNode.addExcludePermission(startID, endID)
                if (status):
                    self.message.includeExcludeSuccess(
                        lines[startIndex], distributorNode.distributorName)
                else:
                    self.message.excludeWarning(
                        lines[startIndex], distributorNode.distributorName)

            startIndex += 1

        while (lines[startIndex] == ''):
            startIndex += 1

        return startIndex - 1

    def processPermissions(self, lines, startIndex, endIndex, distributors):
        while (startIndex <= endIndex):
            dist1, dist2, permissionType = self.inputFormatter.processPermissionFirstLine(
                lines[startIndex])
            dist1 = dist1.strip()
            dist2 = dist2.strip()

            if (dist1 in distributors):
                self.message.duplicateDistributor(lines[startIndex], dist1)

            print("\nAdd Permissions for {}".format(dist1))

            if (dist1 == -1):
                self.message.permissionSyntaxError(lines[startIndex])
                exit(0)

            distributorNode = Distributor(dist1)
            startIndex += 1

            if (permissionType == "Direct"):
                distributors[dist1] = distributorNode
                parentDistributorNode = None
                startIndex = self.addPermissions(lines, startIndex,
                                                 distributorNode,
                                                 parentDistributorNode)

            elif (permissionType == "Inherit"):
                if (dist2 not in distributors):
                    print(
                        "You are trying to assign permission from {} which is not yet set"
                        .format(dist2))
                    exit(0)

                distributors[dist1] = distributorNode
                parentDistributorNode = distributors[dist2]
                startIndex = self.addPermissions(lines, startIndex,
                                                 distributorNode,
                                                 parentDistributorNode)

                for i in range(len(parentDistributorNode.excludes)):
                    distributorNode.excludes.append(
                        parentDistributorNode.excludes[i])

            startIndex += 1
コード例 #12
0
ファイル: RPG.py プロジェクト: Dosugamea/Py-RPG
        else:
            if msg.text == "はい":
                self.userdata[msg._from]["State"]["RPG"]["Step"] = 2
                self.cl.sendMessage(msg.to, "ありがとうございます!\nユーザー情報を登録します...")
                self.register_rpg(msg)
                self.cl.sendMessage(msg.to, "登録しました!\nようこそ RPGへ!")
            elif msg.text == "いいえ":
                self.userdata[msg._from]["State"]["RPG"]["Step"] = 0
                self.userdata[msg._from]["State"]["RPG"]["Game"] = False
                self.cl.sendMessage(msg.to, "気が変わったらまた来てください > <")
            elif msg.text == "利用規約":
                with open("Terms.txt", encoding="utf-8_sig") as f:
                    self.cl.sendMessage(msg.to, f.read())


def atend():
    print("Saving")
    #with open("SaveData.json","w",encoding='utf8') as f:
    #    json.dump(RPGer.rpgdata, f, ens1ure_ascii=False, indent=4,separators=(',', ': '))
    print("BYE")


atexit.register(atend)

if __name__ == '__main__':
    RPGer = RPG()
    RPGer.process_rpg(Message())
    #RPGer.auto_choice([1,1,1,1,1,1,1,1,1,1,1,1,1])
    while True:
        inp = input(">>")
        RPGer.process_rpg(Message(text=inp))
コード例 #13
0
def execMailOrdrD(strLoggerName, strJobPathRES, strDataDate):
    strEDIConnection = "3DW-DWuser@tpe-centos7-maria10-dw"
    strEDIDB = "DMMDL"

    listSystemOrdrYM = getSystemOrdrYMList(strEDIConnection, strEDIDB,
                                           strDataDate)

    for dictSystemOrdrYM in listSystemOrdrYM:
        listOrdrSysD = getOrdrSysDList(strEDIConnection, strEDIDB, strDataDate,
                                       dictSystemOrdrYM["SYSTEM_ORDR_YM"])
        listOrdrTrasD = getOrdrTrasDList(strEDIConnection, strEDIDB,
                                         strDataDate,
                                         dictSystemOrdrYM["SYSTEM_ORDR_YM"])

        if execWriteWorkbook(strJobPathRES, dictSystemOrdrYM["SYSTEM_ORDR_YM"],
                             listOrdrSysD, listOrdrTrasD) == True:
            strMessageSMTPServer = "tw-mail02.want-want.com"
            strMessageSMTPFrom = "*****@*****.**"

            strMessageSubject = "现渠自动化管理平台-订单清单及开单明细报表-" + dictSystemOrdrYM[
                "SYSTEM_ORDR_YM"] + "-" + strDataDate
            strAttachFilePath = strJobPathRES.replace(
                ".dat", "-" + dictSystemOrdrYM["SYSTEM_ORDR_YM"] + ".dat")
            strAttachFileName = "现渠自动化管理平台-订单清单及开单明细报表-" + dictSystemOrdrYM[
                "SYSTEM_ORDR_YM"] + "-" + strDataDate + ".xlsx"

            arrayMessageSMTPTo = [
                "*****@*****.**", "*****@*****.**",
                "*****@*****.**", "*****@*****.**",
                "*****@*****.**"
            ]

            if (os.stat(strAttachFilePath).st_size / 1024 / 1024) > 7:
                strContent = "尊敬的长官:早上好!\n" + \
                    "敬请查阅:截止" + strDataDate[4:6] + "月" + strDataDate[-2:] + "日【" + "现渠自动化管理平台-订单清单及开单明细报表-" + dictSystemOrdrYM["SYSTEM_ORDR_YM"] + "】\n\n" + \
                    "注意!此档案有多个压缩包,请将压缩包置于同一位置后,在.zip压缩文档上点选二下執行解压缩,即可取得EXCEL文档。\n\n"

                strAttachDirPath = os.path.dirname(strAttachFilePath)
                strExcelFilePath = os.path.join(strAttachDirPath,
                                                strAttachFileName)
                strZipFileName = "现渠自动化管理平台-订单清单及开单明细报表-" + dictSystemOrdrYM[
                    "SYSTEM_ORDR_YM"] + "-" + strDataDate
                strZipFilePath = os.path.join(strAttachDirPath, strZipFileName)

                os.rename(strAttachFilePath, strExcelFilePath)

                strCommand = "zip -s 5m -j " + strZipFilePath + " " + strExcelFilePath
                tupleOutput = subprocess.Popen(
                    strCommand, shell=True,
                    stderr=subprocess.PIPE).communicate()
                strErrorOutput = tupleOutput[1].decode('utf-8')
                if strErrorOutput != "":
                    logger = logging.getLogger(strLoggerName)
                    logger.error(strErrorOutput)
                else:
                    for strFileName in os.listdir(strAttachDirPath):
                        if strFileName.startswith(
                                strZipFileName
                        ) == True and strFileName.endswith(".xlsx") == False:
                            Message.sendSMTPMail(
                                strMessageSMTPServer, strMessageSMTPFrom,
                                arrayMessageSMTPTo, strMessageSubject,
                                strContent,
                                os.path.join(strAttachDirPath,
                                             strFileName), strFileName)

                os.rename(strExcelFilePath, strAttachFilePath)
            else:
                strContent = "尊敬的长官:早上好!\n" + \
                    "敬请查阅:截止" + strDataDate[4:6] + "月" + strDataDate[-2:] + "日【" + "现渠自动化管理平台-订单清单及开单明细报表-" + dictSystemOrdrYM["SYSTEM_ORDR_YM"] + "】\n\n"
                Message.sendSMTPMail(strMessageSMTPServer, strMessageSMTPFrom,
                                     arrayMessageSMTPTo, strMessageSubject,
                                     strContent, strAttachFilePath,
                                     strAttachFileName)
        else:
            return False

    return True
コード例 #14
0
def execMailStoreMatlM(strLoggerName, strJobPathRES, strDataDate):
    strEDIConnection = "3DW-DWuser@tpe-centos7-maria10-dw"
    strEDIDB = "DMMDL"

    today = datetime.date.today()
    strTODAY = str(today.year) + ("0" + str(today.month))[-2:] + (
        "0" + str(today.day))[-2:]

    listWorkDayT = getWorkDayT(strEDIConnection, strEDIDB, strDataDate,
                               strTODAY)

    if len(listWorkDayT) == 1:
        if listWorkDayT[0]["WORKDAY_YN"] == "Y" and today.day < 12:
            listStoreMatlMSystem = getStoreMatlMSystemList(
                strEDIConnection, strEDIDB, strDataDate)
            listStoreMatlM = getStoreMatlMList(strEDIConnection, strEDIDB,
                                               strDataDate)
            listStoreM = getStoreMList(strEDIConnection, strEDIDB, strDataDate)

            if execWriteWorkbook(strJobPathRES, listStoreMatlMSystem,
                                 listStoreMatlM, listStoreM) == True:
                strMessageSMTPServer = "tw-mail02.want-want.com"
                strMessageSMTPFrom = "*****@*****.**"

                for dictStoreMatlMSystem in listStoreMatlMSystem:
                    strMessageSubject = dictStoreMatlMSystem[
                        "KA_SYSTEM_NM"] + "-现渠自动化管理平台-门店品项销售数据-" + dictStoreMatlMSystem[
                            "POS_YM"] + "月结算报表-" + strDataDate
                    strAttachFilePath = strJobPathRES.replace(
                        ".dat",
                        "-" + dictStoreMatlMSystem["KA_SYSTEM_CODE"] + ".dat")
                    strAttachFileName = dictStoreMatlMSystem[
                        "KA_SYSTEM_NM"] + "-现渠自动化管理平台-门店品项销售数据-" + dictStoreMatlMSystem[
                            "POS_YM"] + "月结算报表-" + strDataDate + ".xlsx"

                    if dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H002":
                        #  量贩 H002 大润发 : 朱晓菁
                        arrayMessageSMTPTo = [
                            "*****@*****.**",
                            "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H005":
                        #  量贩 H005 麦德龙 : 朱晓菁
                        arrayMessageSMTPTo = [
                            "*****@*****.**",
                            "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H007":
                        #  标超 H007 人人乐 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H009":
                        #  标超 H009 世纪联华 : 朱晓菁
                        arrayMessageSMTPTo = [
                            "*****@*****.**",
                            "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H010":
                        #  量贩 H010 沃尔玛 : 张懿晴
                        arrayMessageSMTPTo = [
                            "*****@*****.**",
                            "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H011":
                        #  标超 H011 物美 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H013":
                        #  量贩 H013 易初莲花 : 许曣
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H016":
                        #  标超 H016 丹尼斯 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H017":
                        #  标超 H017 天虹 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H018":
                        #  标超 H018 华润万家 : 张懿晴
                        arrayMessageSMTPTo = [
                            "*****@*****.**",
                            "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H021":
                        #  标超 H021 美特好 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H042":
                        #  标超 H042 百佳华 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "H060":
                        #  标超 H060 北国系统 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S001":
                        #  标超 S001 农工商 : 张懿晴
                        arrayMessageSMTPTo = [
                            "*****@*****.**",
                            "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S004":
                        #  标超 S004 上海联华 : 朱晓菁
                        arrayMessageSMTPTo = [
                            "*****@*****.**",
                            "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S006":
                        #  标超 S006 苏果 : 朱晓菁
                        arrayMessageSMTPTo = [
                            "*****@*****.**",
                            "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S009":
                        #  便利 S009 中百便民 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S010":
                        #  标超 S010 中百仓储 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S011":
                        #  标超 S011 中商 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S014":
                        #  标超 S014 永辉 : 许曣
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S018":
                        #  标超 S018 武商 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S020":
                        #  标超 S020 威海糖酒 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S026":
                        #  标超 S026 新世纪 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S030":
                        #  便利 S030 红旗连锁 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S031":
                        #  标超 S031 银座 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S044":
                        #  标超 S044 北京华冠 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S052":
                        #  标超 S052 步步高 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S063":
                        #  标超 S063 新华都 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S110":
                        #  标超 S110 联华华商 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S151":
                        #  标超 S151 华联系统 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S219":
                        #  标超 S219 介休吉隆斯 : 杨露露
                        arrayMessageSMTPTo = [
                            "*****@*****.**", "*****@*****.**"
                        ]
                    elif dictStoreMatlMSystem["KA_SYSTEM_CODE"] == "S284":
                        #  标超 S284 重客隆 :
                        arrayMessageSMTPTo = ["*****@*****.**"]
                    else:
                        arrayMessageSMTPTo = ["*****@*****.**"]

                    if (os.stat(strAttachFilePath).st_size / 1024 / 1024) > 7:
                        strContent = "尊敬的长官:早上好!\n" + \
                            "敬请查阅:截止" + strDataDate + "为止," + "【" + dictStoreMatlMSystem["KA_SYSTEM_NM"] + "-门店品项销售数据-" + dictStoreMatlMSystem["POS_YM"] + "月结算报表】\n\n" + \
                            "注意!此档案有多个压缩包,请将压缩包置于同一位置后,在.zip压缩文档上点选二下執行解压缩,即可取得EXCEL文档。\n\n"

                        strAttachDirPath = os.path.dirname(strAttachFilePath)
                        strExcelFilePath = os.path.join(
                            strAttachDirPath, strAttachFileName)
                        strZipFileName = dictStoreMatlMSystem[
                            "KA_SYSTEM_NM"] + "-现渠自动化管理平台-门店品项销售数据-" + dictStoreMatlMSystem[
                                "POS_YM"] + "月结算报表-" + strDataDate
                        strZipFilePath = os.path.join(strAttachDirPath,
                                                      strZipFileName)

                        os.rename(strAttachFilePath, strExcelFilePath)

                        strCommand = "zip -s 5m -j " + strZipFilePath + " " + strExcelFilePath
                        tupleOutput = subprocess.Popen(
                            strCommand, shell=True,
                            stderr=subprocess.PIPE).communicate()
                        strErrorOutput = tupleOutput[1].decode('utf-8')
                        if strErrorOutput != "":
                            logger = logging.getLogger(strLoggerName)
                            logger.error(strErrorOutput)
                        else:
                            for strFileName in os.listdir(strAttachDirPath):
                                if strFileName.startswith(
                                        strZipFileName
                                ) == True and strFileName.endswith(
                                        ".xlsx") == False:
                                    Message.sendSMTPMail(
                                        strMessageSMTPServer,
                                        strMessageSMTPFrom, arrayMessageSMTPTo,
                                        strMessageSubject, strContent,
                                        os.path.join(strAttachDirPath,
                                                     strFileName), strFileName)

                        os.rename(strExcelFilePath, strAttachFilePath)
                    else:
                        strContent = "尊敬的长官:早上好!\n" + \
                            "敬请查阅:截止" + strDataDate + "为止," + "【" + dictStoreMatlMSystem["KA_SYSTEM_NM"] + "-门店品项销售数据-" + dictStoreMatlMSystem["POS_YM"] + "月结算报表】\n\n"

                        Message.sendSMTPMail(strMessageSMTPServer,
                                             strMessageSMTPFrom,
                                             arrayMessageSMTPTo,
                                             strMessageSubject, strContent,
                                             strAttachFilePath,
                                             strAttachFileName)

                return True
            else:
                return False