class Test_Tihuoshenqing_Add_Data(unittest.TestCase):
    """录入仓单提货申请界面数据核对"""
    def setUp(self):
        self.process_front = Process_Front()
        self.process_front.process_login(user_add)
        self.process_front.into_tihuoshenqing()
        self.datas = self.process_front.tihuoshenqing_check(number)

    def test_1(self):
        """循环取数据进行验证"""
        for index, data in enumerate(self.datas):
            count = db.session.query(HistoryData).filter(
                HistoryData.username == user_add,
                HistoryData.stockCode == data.get('stockcode', '未找到'),
                HistoryData.warehouse == data.get('warehouse'),
                HistoryData.goodsid == data.get('goodsid'),
                HistoryData.factoryName == data.get('factoryname'),
                HistoryData.weight == data.get('weightavlb'),
                HistoryData.material == data.get('material'),
                HistoryData.thickness == data.get('thickness'),
                HistoryData.standard_width == data.get('standard_width'),
                HistoryData.format == data.get('format'),
                HistoryData.width == data.get('width'),
                HistoryData.edge == data.get('edge'),
                HistoryData.level == data.get('level'),
                HistoryData.standard_thickness == data.get(
                    'standard_thickness'),
                HistoryData.status == 0,
            ).count()
            self.assertGreater(count, 0, '第{}条数据:{}'.format(index + 1, data))

    def tearDown(self):
        self.process_front.close()
class Test_Apply_One(unittest.TestCase):
    """申请入库一条数据"""

    # username='******'

    def setUp(self):
        self.process_front = Process_Front()
        self.process_front.process_login(user_shenqingruku_one)

        ##获得初始数据
        self.process_front.into_shiwuruku()
        self.start_shiwuruku = self.process_front.get_shiwuruku_count().get(
            'num')
        self.process_front.into_rukushenqingchaxun()
        self.start_rukushenqingchaxun = self.process_front.get_table_count()
        self.process_front.fresh()
        self.process_front.into_shangpinshangjia()
        self.start_shangpinshangjia = self.process_front.get_table_count()

        ##添加明细并且进行入库申请
        self.process_front.into_shiwuruku()
        self.process_front.ruku_add_detail()
        self.process_front.fresh()
        self.process_front.into_shiwuruku()
        self.process_front.shiwuruku_apply(all=False)

        ##获取各个界面操作后的数据
        self.process_front.into_shiwuruku()
        self.end_shiwuruku = self.process_front.get_shiwuruku_count().get(
            'num')
        self.process_front.into_rukushenqingchaxun()
        self.end_rukushenqingchaxun = self.process_front.get_table_count()
        self.process_front.fresh()
        self.process_front.into_shangpinshangjia()
        self.end_shangpinshangjia = self.process_front.get_table_count()

    def test_1(self):
        """各界面统计"""
        self.assertEqual(int(self.start_shiwuruku), int(self.end_shiwuruku),
                         '实物入库界面')
        self.assertEqual(
            int(self.start_rukushenqingchaxun) + 1,
            int(self.end_rukushenqingchaxun),
            '入库申请查询界面,开始数据{},结束数据{}'.format(self.start_rukushenqingchaxun,
                                            self.end_rukushenqingchaxun))
        self.assertEqual(
            int(self.start_shangpinshangjia) + 1,
            int(self.end_shangpinshangjia),
            '商品上架界面,开始数据{},结束数据{}'.format(self.start_shangpinshangjia,
                                          self.end_shangpinshangjia))

    def tearDown(self):
        self.process_front.close()
class Test_Shenqingtihuo_Add_All(unittest.TestCase):
    """录入仓单用户全选数据申请入库"""
    def setUp(self):
        self.process_front = Process_Front()
        self.process_front.process_login(user_add)

        # 获得提货申请界面表格统计数据
        self.process_front.into_tihuoshenqing()
        self.start_num_tihuoshenqing = self.process_front.get_table_count()

        # 获得提货申请查询界面表格统计统计
        self.process_front.fresh()
        self.process_front.into_tihuoshenqingchaxun()
        self.start_num_tihuoshenqingchaxun = self.process_front.get_table_count(
        )

        # 申请一条数据入库
        self.process_front.fresh()
        self.process_front.into_tihuoshenqing()
        self.process_front.shenqingtihuo(one=False)

        # 获得提货申请界面表格统计数据
        self.process_front.fresh()
        self.process_front.into_tihuoshenqing()
        self.end_num_tihuoshenqing = self.process_front.get_table_count()

        # 获得提货申请查询界面表格统计统计
        self.process_front.fresh()
        self.process_front.into_tihuoshenqingchaxun()
        self.end_num_tihuoshenqingchaxun = self.process_front.get_table_count()

    def test_1(self):
        """两个界面数据验证"""
        if self.start_num_tihuoshenqing > 10:
            self.assertEqual(
                self.start_num_tihuoshenqing, self.end_num_tihuoshenqing + 10,
                '提货申请界面表格统计数据验证,初始数据:{},结束数据:{}'.format(
                    self.start_num_tihuoshenqing, self.end_num_tihuoshenqing))
        else:
            self.assertEqual(
                self.end_num_tihuoshenqing, 0,
                '提货申请界面表格统计数据验证,初始数据:{},结束数据:{}'.format(
                    self.start_num_tihuoshenqing, self.end_num_tihuoshenqing))
        self.assertEqual(
            self.start_num_tihuoshenqingchaxun,
            self.end_num_tihuoshenqingchaxun - 1,
            '提货申请查询界面表格统计数据验证,初始数据:{},结束数据:{}'.format(
                self.start_num_tihuoshenqingchaxun,
                self.end_num_tihuoshenqingchaxun))

    def tearDown(self):
        self.process_front.close()
Beispiel #4
0
class Test_Rukushenqingchaxun_Data(unittest.TestCase):
    """"入库申请查询界面数据核对"""

    ##cal_weight
    ##count_weight
    ##data_detail
    # username='******'
    # number=1

    def setUp(self):
        self.process_front = Process_Front()
        self.process_front.process_login(user_add)
        self.process_front.into_rukushenqingchaxun()
        self.datas = self.process_front.rukushengqingchaxun_check(number)

    def test_1(self):
        """随机选择数据进行核对"""
        for index, data in enumerate(self.datas):
            self.assertEqual(
                data.get('cal_weight'), data.get('count_weight'),
                '第{}次重量核对不正确,计算重量{}.界面重量{}'.format(index + 1,
                                                   data.get('cal_weight'),
                                                   data.get('count_weight')))

            for detail in data.get('data_detail'):

                count = db.session.query(HistoryData).filter(
                    HistoryData.username == user_add,
                    HistoryData.goodsid == detail.get('goodsid', '未找到'),
                    HistoryData.stockCode == detail.get('stockcode', '未找到'),
                    HistoryData.factoryName == detail.get(
                        'factoryname', '未找到'),
                    HistoryData.weight == detail.get('weight', '未找到'),
                    HistoryData.material == detail.get('material', '未找到'),
                    HistoryData.thickness == detail.get('thickness', '未找到'),
                    HistoryData.standard_width == detail.get(
                        'standard_width', '未找到'),
                    HistoryData.format == detail.get('format', '未找到'),
                    HistoryData.width == detail.get('width', '未找到'),
                    HistoryData.edge == detail.get('edge', '未找到'),
                    HistoryData.level == detail.get('level', '未找到'),
                    HistoryData.standard_thickness == detail.get(
                        'standard_thickness', '未找到'),
                    HistoryData.warehouse == detail.get('warehouse', '未找到'),
                    HistoryData.status == 0,
                ).count()
                self.assertGreater(count, 0,
                                   '第{}条数据:{}'.format(index + 1, detail))

    def tearDown(self):
        self.process_front.close()
class Test_Shenqingtihuo_Add_one(unittest.TestCase):
    """录入仓单用户选择一条数据申请入库"""

    def setUp(self):
        self.process_front = Process_Front()
        self.process_front.process_login(user_shenqingruku_one)

        # 获得提货申请界面表格统计数据
        self.process_front.into_tihuoshenqing()
        self.start_num_tihuoshenqing = self.process_front.get_table_count()

        # 获得提货申请查询界面表格统计统计
        self.process_front.fresh()
        self.process_front.into_tihuoshenqingchaxun()
        self.start_num_tihuoshenqingchaxun = self.process_front.get_table_count()

        # 申请一条数据入库
        self.process_front.fresh()
        self.process_front.into_tihuoshenqing()
        self.process_front.shenqingtihuo()

        # 获得提货申请界面表格统计数据
        self.process_front.fresh()
        self.process_front.into_tihuoshenqing()
        self.end_num_tihuoshenqing = self.process_front.get_table_count()

        # 获得提货申请查询界面表格统计统计
        self.process_front.fresh()
        self.process_front.into_tihuoshenqingchaxun()
        self.end_num_tihuoshenqingchaxun = self.process_front.get_table_count()

    def test_1(self):
        """两个界面数据验证"""
        self.assertEqual(
            self.start_num_tihuoshenqing,
            self.end_num_tihuoshenqing + 1,
            '提货申请界面表格统计数据验证,开始数据{}.结束数据{}'.format(
                self.start_num_tihuoshenqing,
                self.end_num_tihuoshenqing))
        self.assertEqual(
            self.start_num_tihuoshenqingchaxun,
            self.end_num_tihuoshenqingchaxun - 1,
            '提货申请查询界面表格统计数据验证,开始数据{},结束数据{}'.format(
                self.start_num_tihuoshenqingchaxun,
                self.end_num_tihuoshenqingchaxun))

    def tearDown(self):
        self.process_front.close()
Beispiel #6
0
def input_detail_304(username):
    ##读取excel
    # datas=read_data(r'F:\autotest\peihuo\file\input_file\rukumingxi.xlsx')
    datas = read_data(excel_add_input)

    ##实例化,登录并进入相应界面
    process_front = Process_Front()
    process_front.process_login(username)
    process_front.into_shiwuruku()
    result = []
    for index, data in enumerate(datas):
        ##获得初始数据
        start_data = process_front.get_shiwuruku_count()

        ##录入
        remind_text = process_front.ruku_add_detail(*data)
        process_front.fresh()
        process_front.into_shiwuruku()

        ##获得录入后的数据
        end_data = process_front.get_shiwuruku_count()

        ##如果数字+1,录入成功,否则失败
        if start_data.get('num') + 1 == end_data.get('num'):
            print(index + 1, data[0], '录入成功', remind_text)
            historydata = HistoryData(username, '冷轧304卷', *data, 0)
            db.session.add(historydata)
            db.session.commit()
            one_result = (index + 1, data[0], '录入成功', remind_text)
        else:
            print(index + 1, data[0], '录入失败', remind_text)
            historydata = HistoryData(username, '冷轧304卷', *data, 1)
            db.session.add(historydata)
            db.session.commit()
            one_result = (index + 1, data[0], '录入失败', remind_text)
        result.append(one_result)

    ##以当前时间戳生成文件名,写入excel
    process_front.close()
    write_data(excel_every.format(report_name.get('add')), result,
               ('编号', '钢卷号', '结果', '提示信息'))
Beispiel #7
0
class Test_Fabulishi_Data(unittest.TestCase):
    """发布历史查询界面数据核对"""

    # username='******'
    # number=5

    def setUp(self):
        self.process_front = Process_Front()
        self.process_front.process_login(user_fabu)
        self.process_front.into_fabulishichaxun()
        self.datas = self.process_front.fabulishichaxun_check(number)

    def test_1(self):
        """循环获得的数据进行核对"""
        for index, data in enumerate(self.datas):
            count = db.session.query(Fabu).filter(
                Fabu.username == user_fabu,
                Fabu.contract == data.get('contractid', '未找到'),
                Fabu.premium == data.get('premium', '未找到'),
                Fabu.stockCode == data.get('stockcode', '未找到'),
                Fabu.factoryname == data.get('factoryname', '未找到'),
                Fabu.weight == data.get('weight', '未找到'),
                Fabu.warehouse == data.get('warehouse', '未找到'),
                Fabu.material == data.get('material', '未找到'),
                Fabu.thickness == data.get('thickness', '未找到'),
                Fabu.standard_width == data.get('standard_width', '未找到'),
                Fabu.format == data.get('format', '未找到'),
                Fabu.width == data.get('width', '未找到'),
                Fabu.edge == data.get('edge', '未找到'),
                Fabu.level == data.get('level', '未找到'),
                Fabu.standard_thickness == data.get('standard_thickness',
                                                    '未找到'),
                Fabu.status == 0,
                Fabu.invalidTime == data.get('invalidtime'),
            ).count()
            self.assertGreater(count, 0, '第{}条数据:{}'.format(index + 1, data))

    def tearDown(self):
        self.process_front.close()
Beispiel #8
0
class Test_Sell_Data(unittest.TestCase):
    """匹配查询界面买方数据核对"""

    # username='******'
    # number=5

    def setUp(self):
        self.process_front = Process_Front()
        self.process_front.process_login(user_buy_sell)
        self.process_front.into_pipeichaxun()
        self.datas = self.process_front.pipei_check(number)

    def test_1(self):
        """循环对数据进行验证"""
        for index, data in enumerate(self.datas):
            count = db.session.query(Fabu).filter(
                Fabu.username == user_buy_sold,
                Fabu.goodsid == data.get('goodsid', '未找到'),
                Fabu.contract == data.get('contractid', '未找到'),
                Fabu.weight == data.get('weightmatch', '未找到'),
                Fabu.premium == data.get('premium', '未找到'),
                Fabu.stockCode == data.get('stockcode', '未找到'),
                Fabu.factoryname == data.get('factoryname', '未找到'),
                Fabu.material == data.get('material', '未找到'),
                Fabu.thickness == data.get('thickness', '未找到'),
                Fabu.standard_width == data.get('standard_width', '未找到'),
                Fabu.format == data.get('format', '未找到'),
                Fabu.width == data.get('width', '未找到'),
                Fabu.edge == data.get('edge', '未找到'),
                Fabu.level == data.get('level', '未找到'),
                Fabu.standard_thickness == data.get('standard_thickness',
                                                    '未找到'),
                Fabu.warehouse == data.get('warehouse', '未找到'),
                Fabu.status == 0,
            ).count()
            self.assertGreater(count, 0, '第{}条数据:{}'.format(index + 1, data))

    def tearDown(self):
        self.process_front.close()
Beispiel #9
0
class Test_Kucunchaxun_Data(unittest.TestCase):
    """库存查询界面数据核对"""

    # username='******'
    # number=3

    def setUp(self):
        self.process_front = Process_Front()
        self.process_front.process_login(user_add)
        self.process_front.into_kucunchaxun()
        self.datas = self.process_front.kucunchaxun_check(number)

    def test_1(self):
        """取数据进行核对"""
        for index, data in enumerate(self.datas):
            count = db.session.query(HistoryData).filter(
                HistoryData.username == user_add,
                HistoryData.goodsid == data.get('goodsid', '未找到'),
                HistoryData.stockCode == data.get('stockcode', '未找到'),
                HistoryData.factoryName == data.get('factoryname', '未找到'),
                HistoryData.weight == data.get('weight', '未找到'),
                HistoryData.remark == data.get('remark', '未找到'),
                HistoryData.material == data.get('material', '未找到'),
                HistoryData.thickness == data.get('thickness', '未找到'),
                HistoryData.standard_width == data.get(
                    'standard_width', '未找到'), HistoryData.format == data.get(
                        'format',
                        '未找到'), HistoryData.width == data.get('width', '未找到'),
                HistoryData.edge == data.get('edge', '未找到'),
                HistoryData.level == data.get('level', '未找到'),
                HistoryData.standard_thickness == data.get(
                    'standard_thickness',
                    '未找到'), HistoryData.warehouse == data.get(
                        'warehouse', '未找到'), HistoryData.status == 0).count()
            self.assertGreater(count, 0, '第{}条数据:{}'.format(index + 1, data))

        def tearDown(self):
            self.process_front.close()
class Test_Index_Data(unittest.TestCase):
    """测试首页数据正确性"""

    # number=5
    # username='******'

    def setUp(self):
        self.process_front = Process_Front()
        self.process_front.open_url('http://192.168.1.43:8083/')
        self.datas = self.process_front.index_check(number, 304)

    def test_1(self):
        """测试首页数据与发布数据一致性"""
        for index, data in enumerate(self.datas):
            count = db.session.query(Fabu).filter(
                Fabu.username == user_fabu,
                Fabu.contract == data.get('contract', '未找到'),
                Fabu.premium == data.get('premium', '未找到'),
                Fabu.factoryname == data.get('factoryname', '未找到'),
                Fabu.weight == data.get('weightleft', '未找到'),
                Fabu.warehouse == data.get('warehouse', '未找到'),
                Fabu.material == data.get('material', '未找到'),
                Fabu.thickness == data.get('thickness', '未找到'),
                Fabu.standard_width == data.get('standard_width', '未找到'),
                Fabu.format == data.get('format', '未找到'),
                Fabu.width == data.get('width', '未找到'),
                Fabu.edge == data.get('edge', '未找到'),
                Fabu.level == data.get('level', '未找到'),
                Fabu.standard_thickness == data.get('standard_thickness',
                                                    '未找到'),
                Fabu.status == 0,
            ).count()
            self.assertGreater(count, 0, '第{}条数据:{}'.format(index + 1, data))

    def tearDown(self):
        self.process_front.close()
Beispiel #11
0
class Test_Shangpin_Data(unittest.TestCase):
    """验证商品上架界面的数据是否一致"""

    # username='******'
    # number=3

    def setUp(self):
        self.process_front = Process_Front()
        self.process_front.process_login(user_add)
        self.process_front.into_shangpinshangjia()
        self.tabledatas = self.process_front.shangpinshangjia_check(number)

    def test_1(self):
        """对随机取的数据进行验证"""
        for index, data in enumerate(self.tabledatas):
            count = db.session.query(HistoryData).filter(
                HistoryData.username == user_add,
                HistoryData.goodsid == data.get('goodsid', '未找到'),
                HistoryData.stockCode == data.get('stockcode', '未找到'),
                HistoryData.factoryName == data.get('factoryname', '未找到'),
                HistoryData.weight == data.get('weight', '未找到'),
                HistoryData.material == data.get('material', '未找到'),
                HistoryData.thickness == data.get('thickness', '未找到'),
                HistoryData.standard_width == data.get(
                    'standard_width', '未找到'), HistoryData.format == data.get(
                        'format',
                        '未找到'), HistoryData.width == data.get('width', '未找到'),
                HistoryData.edge == data.get('edge', '未找到'),
                HistoryData.level == data.get('level', '未找到'),
                HistoryData.standard_thickness == data.get(
                    'standard_thickness', '未找到'),
                HistoryData.warehouse == data.get('warehouse')).count()
            self.assertGreater(count, 0, '第{}条数据:{}'.format(index + 1, data))

    def tearDown(self):
        self.process_front.close()
class Test_Detail_Data(unittest.TestCase):
    """验证实物入库的数据是否与输入的一致"""

    # username='******'
    # data_number=3


    def setUp(self):
        self.process_front=Process_Front()
        self.process_front.process_login(user_add)
        self.process_front.into_shiwuruku()
        self.datas =self.process_front.get_shiwuruku_alldata(number)

    def test_1(self):
        """测试录入的数据是否在数据库中"""
        for index,data in enumerate(self.datas):
            count=db.session.query(HistoryData).filter(HistoryData.username==user_add,
                                                 HistoryData.goodsid==data.get('goodsid','未找到'),
                                                 HistoryData.stockCode==data.get('stockcode','未找到'),
                                                 HistoryData.factoryName==data.get('factoryname','未找到'),
                                                 HistoryData.weight==data.get('weight','未找到'),
                                                 HistoryData.remark==data.get('remark','未找到'),
                                                 HistoryData.material==data.get('material','未找到'),
                                                 HistoryData.thickness==data.get('thickness','未找到'),
                                                 HistoryData.standard_width==data.get('standard_width','未找到'),
                                                 HistoryData.format==data.get('format','未找到'),
                                                 HistoryData.width==data.get('width','未找到'),
                                                 HistoryData.edge==data.get('edge','未找到'),
                                                 HistoryData.level==data.get('level','未找到'),
                                                 HistoryData.standard_thickness==data.get('standard_thickness','未找到'),
                                                 HistoryData.warehouse==data.get('warehouse','未找到'),
                                                 HistoryData.status==0).count()
            self.assertGreater(count,0,'第{}条数据:{}'.format(index+1,data))

    def tearDown(self):
        self.process_front.close()
Beispiel #13
0
def fabu_304(username):
    ##读取excel
    datas = read_data(excel_fabu_input)

    ##实例化
    process_front=Process_Front()
    process_front.process_login(username)
    process_front.into_shangpinshangjia()

    ##判断商品上架界面数据是否足够,不够就自己录入补足
    shangpinshangjia_count=int(process_front.get_table_count())
    if len(datas)>shangpinshangjia_count:
        value=len(datas)-shangpinshangjia_count
        for i in range(value):
            process_front.into_shiwuruku()
            process_front.ruku_add_detail(stockCode='{}{}'.format(username,datetime.datetime.now().strftime('%Y%m%d%H%M%S')))
            process_front.fresh()

        ##全部申请入库
        process_front.fresh()
        process_front.into_shiwuruku()
        process_front.shiwuruku_apply()

    ##进入商品上架
    process_front.fresh()
    process_front.into_shangpinshangjia()
    result=[]
    for index,data in enumerate(datas):
        ##获得初始数据,表格第一条数据以及数据总数
        start_count=int(process_front.get_table_count())
        print('第{}次,初始数据{}'.format(index,start_count))
        tr=process_front.get_table_trs()[0]
        data_detail={
            'goodsname':tr.find('td',attrs={'name':'goodsName'}).text,
            'stockcode': tr.find('td', attrs={'name': 'stockCode'}).text,
            'goodsid': tr.find('td', attrs={'name': 'goodsId'}).text,
            'factoryname': tr.find('td', attrs={'name': 'factoryName'}).text,
            'weight': tr.find('td', attrs={'name': 'weightAvlb'}).text,
            'factoryid': tr.find('td', attrs={'name': 'factoryId'}).text,
            'material': tr.find('td', attrs={'name': '1'}).text,
            'thickness': tr.find('td', attrs={'name': '2'}).text,
            'standard_width': tr.find('td', attrs={'name': '3'}).text,
            'format': tr.find('td', attrs={'name': '4'}).text,
            'width': tr.find('td', attrs={'name': '5'}).text,
            'edge': tr.find('td', attrs={'name': '6'}).text,
            'level': tr.find('td', attrs={'name': '7'}).text,
            'standard_thickness': tr.find('td', attrs={'name': '8'}).text,
            'warehouse': tr.find('td', attrs={'name': 'warehouseName'}).text,
            'stocktype': tr.find('td', attrs={'name': 'stockType'}).text,
            'issueid': tr.find('td', attrs={'name': 'issueId'}).text,
            'applyid': tr.find('td', attrs={'name': 'applyId'}).text,
            'stockid': tr.find('td', attrs={'name': 'stockId'}).text,
        }
        text=process_front.fabu(premium=data[2],contract=data[0],date_valid=True if data[1]=='1' else False)
        process_front.fresh()
        process_front.into_shangpinshangjia()
        end_count=int(process_front.get_table_count())
        print('第{}次,结束数据{}'.format(index, end_count))


        if start_count-end_count==1:
            ##发布成功
            fabu=Fabu(
                username=username,
                goodsid=data_detail.get('goodsname'),
                stockCode=data_detail.get('stockcode'),
                factoryname=data_detail.get('factoryname'),
                weight=data_detail.get('weight'),
                material=data_detail.get('material'),
                standard_thickness=data_detail.get('standard_thickness'),
                standard_width=data_detail.get('standard_width'),
                format=data_detail.get('format'),
                width=data_detail.get('width'),
                edge=data_detail.get('edge'),
                level=data_detail.get('level'),
                thickness=data_detail.get('thickness'),
                warehouse=data_detail.get('warehouse'),
                applyid=data_detail.get('applyid'),
                stockid=data_detail.get('stockid'),
                status=0,
                contract=data[0],
                invalidtime=datetime.datetime.today().strftime('%Y-%m-%d') if data[1]=='1' else '',
                premium=str(int(float(data[2])*1000)),
            )
            ##加入数据库
            db.session.add(fabu)
            db.session.commit()
            ##excel写入内容
            result_one=[index+1,data[0],data[1],data[2],'发布成功',text]
            result.append(result_one)

        else:
            ##发布失败
            fabu = Fabu(
                username=username,
                goodsid=data_detail.get('goodsname'),
                stockCode=data_detail.get('stockcode'),
                factoryname=data_detail.get('factoryname'),
                weight=data_detail.get('weight'),
                material=data_detail.get('material'),
                standard_thickness=data_detail.get('standard_thickness'),
                standard_width=data_detail.get('standard_width'),
                format=data_detail.get('format'),
                width=data_detail.get('width'),
                edge=data_detail.get('edge'),
                level=data_detail.get('level'),
                thickness=data_detail.get('thickness'),
                warehouse=data_detail.get('warehouse'),
                applyid=data_detail.get('applyid'),
                stockid=data_detail.get('stockid'),
                status=1,
                contract=data[0],
                invalidtime=datetime.datetime.today().strftime('%Y-%m-%d') if data[1]=='1' else '',
                premium=data[2],
            )
            ##加入数据库
            db.session.add(fabu)
            db.session.commit()
            ##excel写入内容
            result_one = [index+1, data[0],data[1],data[2],'发布失败', text]
            result.append(result_one)
    ##关闭网页,将结果写入excel
    process_front.close()
    now=datetime.datetime.now().strftime('%Y%m%d%H%M%S')
    write_data(excel_every.format(report_name.get('fabu')),result,('编号','合约名称','日期是否有效','升贴水','结果','提示信息'))