def updateAddress(orderId,
                  consignorName=faker.name(),
                  consignorPhone=faker.phone_number(),
                  deliveryMode='SELF_PIKE_UP',
                  districtCode=110101000000,
                  payOnDelivery=True,
                  postcode=faker.postcode(),
                  file='file',
                  receivingAddress=faker.address(),
                  receivingIdCard=faker.ssn(),
                  receivingName=faker.name(),
                  receivingPhone=faker.phone_number()):
    body = {
        'consignorName': consignorName,  # 提货人姓名
        'consignorPhone': consignorPhone,  # 提货人电话
        'deliveryMode': deliveryMode,  # 收货方式
        'districtCode': districtCode,  # 收件区域
        'orderId': orderId,
        'payOnDelivery': payOnDelivery,  # 是否到付
        'postcode': postcode,
        'powerOfAttorney': file,  # 提货委托书
        'receivingAddress': receivingAddress,  # 收件地址
        'receivingIdCard': receivingIdCard,  # 身份证号
        'receivingName': receivingName,  # 收件人
        'receivingPhone': receivingPhone  # 收件人联系电话
    }
    response = request.post_body('/adhocOrder/updateAddress', body=body)
    return response
 def create_ToolsKit(self,
                     goodsId,
                     name=str(timeStamp),
                     skuCode=timeStamp,
                     remark='哈哈哈',
                     toolsKitCategory=None,
                     manufacturerId=1,
                     goodsQuantity=1):
     url = '/kitTemplate/addToolsKit'
     body = {
         "name": name,
         "skuCode": skuCode,
         "toolsKitCategory": toolsKitCategory,
         "manufacturerId": manufacturerId,
         "remark": remark,
         "toolsDetails": [{
             "goodsId": goodsId,
             "goodsQuantity": goodsQuantity
         }]
     }
     response = request.post_body(url, body)
     # try:
     #     assert response['msg'] == '请求成功'
     # except Exception:
     #     raise response
     return response
Beispiel #3
0
 def add_default_address(self):
     url = '/supplier/addReceivingAddress'
     body = {
         "receivingName": "收件人",
         "receivingPhone": "13333333338",
         "districtCode": 110101000000,  # 地址代码
         "receivingAddress": "详情地址"
     }
     response = request.post_body(url, body)
class TestAllocateOrder:
    data = [('调拨理由为空', {'reasonCode': None}, '请选择调拨理由'),
            ('来源仓库空', {'sourceWarehouseId': None}, '请选择来源仓库'),
            ('来源仓库错误', {'targetWarehouseId': 'aa'}, '请求参数异常'),
            ('收货仓库为空', {'targetWarehouseId': None}, '请选择目标仓库'),
            # ('收货仓库错误', {'targetWarehouseId': 9999999}, '请求参数异常'),
            # ('商品ID为空', {'goodsId': None}, ''),
            ('商品数量为空', {'goodsQuantity': None}, '请输入商品数量'),
            ('商品数量过大', {'goodsQuantity': 999999999999}, '商品数量超出限制'),
            ('商品信息为空', {'goodsLotInfoId': None}, '参数异常'),
            ('工具包数量过大', {'kitStockQuantity': 99999999999999}, '工具包数量超出限制')
            ]

    @pytest.mark.parametrize('title,case,expected', data)
    @allure.title('{title}')
    def test_create(self, title, case, expected, AllocateOrder_get_Id):
        url = '/allocateOrder/create'
        body = timeid(file_yaml='request_data.yaml')._get_yaml_element_info()[url]
        body = request.reValue(body, case)
        response = request.post_body(url, body)
        assert response['msg'] == expected
 def create(self,
            reasonCode=None,
            sourceWarehouseId=None,
            targetWarehouseId=None,
            goodsId=None,
            goodsLotInfoId=None,
            goodsQuantity=1,
            kitStockId=None,
            kitStockQuantity=1,
            Id=None):
     url = '/allocateOrder/create'
     body = {
         "baseOrderInfo": {
             "id": Id,
             "reasonCode": reasonCode,
             "reason": "",
             "sourceWarehouseId": sourceWarehouseId,
             "targetWarehouseId": targetWarehouseId
         },
         "goodsDetailUiBeans": [{
             "goodsId": goodsId,
             "goodsLotInfoId": goodsLotInfoId,
             "goodsQuantity": goodsQuantity
         }],
         "toolsDetailUiBeans": [],
         "toolKitDetailUiBeans": [{
             "kitStockId": kitStockId,
             "kitStockQuantity": kitStockQuantity
         }]
     }
     response = request.post_body(url, body)
     Id = response['data']['id']
     code = response['data']['code']
     try:
         assert response['msg'] == '请求成功'
     except Exception:
         raise response
     return Id, code
Beispiel #6
0
 def adhocOrder_create(self,
                       procedureSite=95,
                       procedureTime=timeStamp,
                       expectReturnTime=fiveDaysAfter_stamp,
                       manufacturerId=None,
                       gender='FEMALE',
                       ageGroup='TEENAGERS',
                       deliveryMode='SELF_PIKE_UP',
                       addressId=None,
                       supplierId=supplierId,
                       goodsId=None,
                       goodsQuantity=1,
                       goodsSupplierId=8,
                       kitTemplateId=None,
                       toolsQuantity=1,
                       toolsSupplierId=3,
                       hospitalName="医院名称",
                       contactName="订单联系人",
                       contactPhone="13333333333",
                       receivingName="收件人",
                       surgeon='主刀医生'):
     url = '/adhocOrder/create'
     body = {
         "toolsDetailUiBeans": [],
         "goodsDetailUiBeans": [],
         "orderUiBean": {
             "hospitalName":
             hospitalName,  # 医院名称
             "procedureSite": [procedureSite],  # 手术部位
             "surgeon":
             surgeon,  # 主刀医生
             "procedureTime":
             procedureTime,  # 手术日期
             "expectReturnTime":
             expectReturnTime,  # 归还日期
             "contactName":
             contactName,  # 订单联系人
             "contactPhone":
             contactPhone,  # 联系人电话
             "manufacturerId":
             manufacturerId,  # 品牌
             "salesPerson":
             "销售人员",  # 销售人员
             "gender":
             gender,  # 性别 : 女
             "ageGroup":
             ageGroup,  # 患者年龄段 :青少年
             "deliveryMode":
             deliveryMode,  # 提货方式 :自提
             "payOnDelivery":
             True,  # 是否到付: 默认只能选择 到付
             "receivingName":
             receivingName,  # 收件人
             "consignorName":
             "提货人",  # 提货人
             "consignorPhone":
             "13212345567",  # 提货人电话
             "receivingIdCard":
             "421322199811044619",  # 提货人身份证号
             "powerOfAttorney":
             "http://192.168.10.254:9191/server/file/2021/05/17/5b15b54d-de1f-4aab-ab5b"
             "-ffe6bc5a6998/base64Test.jpg",  # 提货委托书照片
             "addressId":
             addressId,  # 默认地址
             "supplierId":
             supplierId  # 经销商ID
         }
     }
     goodsDetailUiBeans = {
         "goodsId": goodsId,  # 物资ID
         "quantity": goodsQuantity,  # 物资数量
         "supplierId": goodsSupplierId  # 物资供应商
     }
     toolsDetailUiBeans = {
         "kitTemplateId": kitTemplateId,  # 工具包ID
         "quantity": toolsQuantity,  # 工具包数量
         "supplierId": toolsSupplierId  # 工具包供应商
     }
     if goodsId is not None:
         body['goodsDetailUiBeans'].append(goodsDetailUiBeans)
     if kitTemplateId is not None:
         body['toolsDetailUiBeans'].append(toolsDetailUiBeans)
     if deliveryMode == 'DELIVERY':
         del body['consignorName'], body['consignorPhone'], body[
             'receivingIdCard'], body['powerOfAttorney']
     response = request.post_body(url, body)
     try:
         response['msg'] == '请求成功'
     except Exception:
         raise response
 def create_Goods(
         self,
         name=str(timeStamp),
         skuCode=timeStamp,
         goodsCategory=101,
         maintenanceCategory=126,
         manufacturerId=1,
         minGoodsUnit=23,
         origin='测试地址',
         nearExpirationDate=5,
         std2012Category=373,
         storageConditions=100,
         model='333',
         specification='222',
         imageSource=[
             '/file/2021/05/08/699fac64-f246-44c2-b6d9-95fbca00b716/base64Test.jpeg'
         ],
         registrationImg='/file/2021/05/08/699fac64-f246-44c2-b6d9-95fbca00b716/base64Test.jpeg',
         longEffect=False,
         registrationEndDate=fiveDaysAfter_stamp,
         registrationBeginDate=timeStamp,
         registrationNum='123456'):
     url = '/goods/createGoods'
     body = {
         "type":
         self.type,  # 物资
         "goodsCategory":
         goodsCategory,  # 物资类型
         "maintenanceCategory":
         maintenanceCategory,  # 养护类别
         "manufacturerId":
         manufacturerId,  # 生产企业
         "minGoodsUnit":
         minGoodsUnit,  # 基本单位
         "name":
         name,  # 物资名字
         "origin":
         origin,  # 产地
         "nearExpirationDate":
         nearExpirationDate,  # 近效期
         "std2012Category":
         std2012Category,
         "storageConditions":
         storageConditions,  # 存储条件
         "specificationList": [{
             "model":
             model,  # 型号
             "skuCode":
             skuCode,  # 原厂编码 -- 不可重复
             "specification":
             specification,  # 规格
             "imageSource":
             imageSource,  # 商品照片
             "createRegistrationInfoUiList": [{
                 "longEffect":
                 longEffect,  # 是否长期有效
                 "registrationEndDate":
                 registrationEndDate,  # 注册证失效日期
                 "registrationBeginDate":
                 registrationBeginDate,  # 注册证生效日期
                 "registrationImg":
                 registrationImg,  # 注册证照
                 "registrationNum":
                 registrationNum  # 注册证号
             }]
         }]
     }
     response = request.post_body(url, body)
     # try:
     #     assert response['msg'] == '请求成功'
     # except Exception:
     #     raise response
     return response
def appCreateAdhocOrder(goodsId,
                        goodsQuantity=1,
                        kitTemplateId=None,
                        ageGroup='adult',
                        gender='male',
                        goodsSupplierId=supplierId,
                        supplierId=supplierId,
                        hospitalName='测试',
                        siteId=siteId,
                        surgeon=faker.name(),
                        procedureTime=tomorrow_stamp,
                        expectReturnTime=twoDaysAfter_stamp,
                        postcode=faker.postcode(),
                        contactName='测试',
                        contactPhone=faker.phone_number(),
                        manufacturerId=brandId,
                        salesPerson=faker.name(),
                        deliveryMode='DELIVERY',
                        receivingName=faker.name(),
                        receivingIdCard=None,
                        receivingPhone=faker.phone_number(),
                        districtCode=110101000000,
                        receivingAddress=faker.address(),
                        powerOfAttorney=None,
                        consignorName=None,
                        consignorPhone=None):
    # # 查询商品主耗材列表
    # goods = request.get('/goods/findListByMainMaterial?pageNum=0&pageSize=50&manufacturerId=%d' % brandId)
    # goodsId = goods['data']['rows'][0]['id']
    # stockQuantity = goods['data']['rows'][0]['stockQuantity']

    # 创建临调单的参数
    body = {
        'toolsDetailUiBeans': [],
        'goodsDetailUiBeans': [],
        'orderUiBean': {
            'ageGroup': ageGroup,  # 年龄段
            'gender': gender,  # 性别
            'supplierId': supplierId,
            'hospitalName': hospitalName,
            'procedureSite': [siteId],
            'surgeon': surgeon,
            'procedureTime': procedureTime,
            'expectReturnTime': expectReturnTime,
            'postcode': postcode,
            'contactName': contactName,
            'contactPhone': contactPhone,
            'manufacturerId': manufacturerId,
            'salesPerson': salesPerson,  # 销售人员
            'deliveryMode': deliveryMode,  # 快递DELIVERY  自提SELF_PIKE_UP
            'receivingName': receivingName,  # 收件人
            'receivingIdCard': receivingIdCard,  # 提货人身份证号
            'receivingPhone': receivingPhone,  # 提货人电话
            'districtCode': districtCode,  # 收件区域
            'receivingAddress': receivingAddress,  # 收件地址
            'powerOfAttorney': powerOfAttorney,  # 提货委托书
            'consignorName': consignorName,  # 提货人姓名
            'consignorPhone': consignorPhone  # 提货人电话
        }
    }
    # 物资信息
    goods = {
        'goodsId': goodsId,
        'quantity': goodsQuantity,
        # 'supplierId': goodsSupplierId
    }
    body['goodsDetailUiBeans'] = [goods]
    if kitTemplateId != None:
        # 工具包信息
        tools = {
            "kitTemplateId": kitTemplateId,
            "quantity": 1,
            # "supplierId": goodsSupplierId
        }
        body['toolsDetailUiBeans'] = [tools]
    # 创建临调单
    create = request.post_body('/adhocOrder/appCreate', body=body)
    return create
class TestAdhocOrder:
    data = [
        ('物资id为空', {
            'goodsId': None
        }, '请输入商品id'),
        ('物资ID错误', {
            'goodsId': 1111111
        }, '商品不存在,请刷新重试'),
        ('套包ID为空', {
            'kitTemplateId': None
        }, '请输入套包id'),
        ('套包ID错误', {
            'kitTemplateId': 1111111
        }, '工具包不存在,请刷新重试'),
        ('物资、套包为空', {
            'goodsDetailUiBeans': [],
            'toolsDetailUiBeans': []
        }, '请选择物资'),
        ('医院为空', {
            'hospitalName': None
        }, '请输入医院名称'),
        ('医院名字超长', {
            'hospitalName': context
        }, '医院名称长度超出限制'),
        ('手术部位为空', {
            'procedureSite': None
        }, '请选择手术部位'),
        ('手术部位错误', {
            'procedureSite': [9999999]
        }, '请选择正确的手术部位'),
        ('主刀医生为空', {
            'surgeon': None
        }, '请输入正确的主刀医生姓名'),
        ('主刀医生超长', {
            'surgeon': longName
        }, '主刀医生名称长度超出限制'),
        ('订单联系人为空', {
            'contactName': None
        }, '请输入正确的联系人姓名'),
        ('联系人电话为空', {
            'contactPhone': None
        }, '请输入正确的手机号码'),
        ('品牌为空', {
            'manufacturerId': None
        }, '品牌不能为空'),
        ('收货方式为空', {
            'deliveryMode': None
        }, '请选择收货方式'),
        ('性别为空', {
            'gender': None
        }, '请选择患者性别'),
        ('年龄段为空', {
            'ageGroup': None
        }, '请选择患者年龄'),
        ('年龄段错误', {
            'ageGroup': 'None'
        }, '请求参数异常'),
        # ('收件人为空', {'receivingName': None}, ''),
        ('默认地址为空', {
            'addressId': None
        }, '请输入收货地址id'),
        ('默认地址错误', {
            'addressId': 9999999
        }, '所选地址不存在,请刷新重试'),
        # ('经销商为空', {'supplierId': None}, ''),
        ('手术时间为空', {
            'procedureTime': None
        }, '请选择手术日期'),
        ('归还时间为空', {
            'expectReturnTime': None
        }, '请选择归还日期'),
        ('手术日期小于当天', {
            'procedureTime': yesterday_stamp
        }, '手术日期不能早于当天'),
        ('归还时间小于手术开始时间', {
            'expectReturnTime': yesterday_stamp
        }, '预计归还日期不能早于手术日期'),
    ]

    @pytest.mark.parametrize('title,case,expected', data)
    @allure.title('{title}')
    def test_create(self, title, case, expected, AdhocOrder_get_id):
        url = '/adhocOrder/create'
        body = timeid(
            file_yaml='request_data.yaml')._get_yaml_element_info()[url]
        body = request.reValue(body, case)
        response = request.post_body(url, body)
        assert response['msg'] == expected
 def test_edit(self, AllocateOrder_get_Id):
     url = '/allocateOrder/create'
     body = timeid(file_yaml='request_data.yaml')._get_yaml_element_info()[url]
     body = request.reValue(body, {'id': AllocateOrder_get_Id})
     response = request.post_body(url, body)
     assert response['msg'] == '只能修改驳回的订单'