createBatch.py 1.48 KB
# -*- coding: utf-8 -*-

# @Time    : 2021/9/29 10:11
# @Author  : Ljq
# @File    : createBatch.py
# @Software: PyCharm

"""

"""

import sys
from commons.api.hg.CheckIn import CheckInMoreGoods as CIMG
from commons.MySession import sessionHg



class createBat(object):
    def __init__(self):
        self.host = "http://test.gateway.diligrp.com:8285"
        data = {i.split("=")[0]: i.split("=")[1] for i in sys.argv if "=" in i}
        if "ic" not in data.keys() or data["ic"] == "":
            self.ic = "888800010591"
        if "goodsName" not in data.keys() or data["goodsName"] == "":
            self.goodsName = "葡萄"
        if "allLevelKeyword" not in data.keys() or data["allLevelKeyword"] == "":
            self.allLevelKeyword = "万州"
        if "nameLike" not in data.keys() or data["nameLike"] == "":
            self.nameLike = "西区"
        if "tradePassword" not in data.keys() or data["tradePassword"] == "":
            self.tradePassword = "111111"
        if "weight" not in data.keys() or data["weight"] == "":
            self.weight = "50"

    def main(self):
        res = CIMG.create_registerRecord(session=sessionHg,ic=self.ic,host=self.host,goodsName=self.goodsName,
                                         allLevelKeyword=self.allLevelKeyword,nameLike=self.nameLike,
                                         tradePassword=self.tradePassword,weight=self.weight)
        print(res.text)
        print(res.json()["data"]["batchCode"])


createBat = createBat().main()