コード例 #1
0
 def edit_ToolsKit(self,
                   goodsId,
                   kitTemplateId,
                   skuCode=timeStamp,
                   remark='哈哈哈',
                   goodsQuantity=1,
                   kitCategory=1,
                   kitTemplateName=str(timeStamp),
                   manufacturerId=1):
     # kitTemplateId = self.get_KitTemplateList(toolKitName=toolKitName)
     url = '/kitTemplate/editToolsKit'
     body = {
         "skuCode": skuCode,
         "remark": remark,
         "manufacturerId": manufacturerId,
         "toolsDetails": [{
             "goodsId": goodsId,
             "goodsQuantity": goodsQuantity
         }],
         "kitCategory": kitCategory,
         "kitTemplateId": kitTemplateId,  # 工具包id
         "kitTemplateName": kitTemplateName
     }
     response = request.put_body(url, body)
     # try:
     #     assert response['msg'] == '请求成功'
     # except Exception:
     #     raise response
     return response
コード例 #2
0
def success(id, deliveryMode='DELIVERY', warehouseId=6, goodsId=None, quantity=None, kitTemplateId=None, Tquantity=1):
    body = {
        "detail": [
            {
                "deliveryMode": deliveryMode,
                "goodsDetailUiBeans": [],
                "toolsDetailUiBeans": [],
                "warehouseId": warehouseId
            }
        ],
        "id": id
    }
    if goodsId != None:
        goods = {
            "goodsId": goodsId,
            "quantity": quantity
        }
        body['detail'][0]['goodsDetailUiBeans'] = [goods]

    if kitTemplateId != None:
        tools = {

            "kitTemplateId": kitTemplateId,
            "quantity": Tquantity

        }
        body['detail'][0]['toolsDetailUiBeans'] = [tools]
    success = request.put_body('/adhocOrder/accept', body=body)

    return success
コード例 #3
0
 def edit_price(
     self,
     id,
     type='purchase',
     price=None,
     discountRate=5000.01,
     purchasePrice=10000.02,
     taxRate=10000.03,
 ):
     # 采购价 type = 'purchase'
     # 临调家 type = 'adhoc'
     url = '/goods/editPrice'
     body = {
         "id": id,
         "type": type,
         "price": price,  # 临调价
         "discountRate": discountRate,  # 折扣率
         "purchasePrice": purchasePrice,  # 采购价
         "taxRate": taxRate  # 税率
     }
     response = request.put_body(url, body)
     # try:
     #     assert response['msg'] == '请求成功'
     # except Exception:
     #     raise response
     return response
コード例 #4
0
def edit_order1(orderUiBean, goodsDetail, toolsDetail):
    body = {
        'orderUiBean': orderUiBean,
        'goodsDetailUiBeans': goodsDetail,
        'toolsDetailUiBeans': toolsDetail
    }
    response = request.put_body('/adhocOrder/edit', body=body)
    return response
コード例 #5
0
def app_edit_order(id, goodsDetail, toolsDetail):
    body = {
        'id': id,
        'goodsDetailUiBeans': goodsDetail,
        'toolsDetailUiBeans': toolsDetail
    }
    response = request.put_body('/adhocOrder/appEdit', body=body)
    return response
コード例 #6
0
def reject(id, reason=None):
    body = {
        "id": id,
        "reason": reason
    }
    reject = request.put_body('/adhocOrder/reject', body=body)

    return reject
コード例 #7
0
 def delete_ToolsKit(self, kitTemplateId=None):
     url = '/kitTemplate/deleteKitTemplate'
     body = {"ids": [kitTemplateId]}
     response = request.put_body(url, body)
     # try:
     #     assert response['msg'] == '请求成功'
     # except Exception:
     #     raise response
     return response
コード例 #8
0
 def edit_Price(self, id, price=1100):
     url = '/kitTemplate/editPrice'
     body = {"id": id, "price": price}
     response = request.put_body(url, body)
     # try:
     #     assert response['msg'] == '请求成功'
     # except Exception:
     #     raise response
     return response
コード例 #9
0
 def edit_GoodsDi(self, di, id):
     url = '/goods/editGoodsDi'
     body = {"di": di, "id": id}
     response = request.put_body(url, body)
     # try:
     #     assert response['msg'] == '请求成功'
     # except Exception:
     #     raise response
     return response
コード例 #10
0
 def delete_Goods(self, id):
     url = '/goods/deleteGoods'
     # id = self.getList(webKeyword=webKeyword, Type=self.type)
     body = {'ids': [id]}
     response = request.put_body(url, body)
     # try:
     #     assert response['msg'] == '请求成功'
     # except Exception:
     #     raise response
     return response
コード例 #11
0
def pickOne(goodsId, lotNum, serialNumber, storageLocationId, pickOrderId):
    body = {
        'goodsId': goodsId,
        'lotNum': lotNum,
        'pickOrderId': pickOrderId,
        'serialNumber': serialNumber,
        'storageLocationId': storageLocationId
    }
    pick_response = request.put_body('/pickOrder/picking', body=body)
    return pick_response
コード例 #12
0
    def approve(self, approve=False, Id=103, rejectReason='不通过'):
        """

        :param approve: False 驳回  、True  通过
        :param Id: 调拨单ID
        :param rejectReason: 驳回理由
        :return:
        """
        url = '/allocateOrder/approve'
        body = {"approve": approve, "id": Id, "rejectReason": rejectReason}
        response = request.put_body(url, body)
        return response
コード例 #13
0
 def edit_Goods(
         self,
         id,
         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/editGoods'
     # id = self.getList(webKeyword=webKeyword, Type=self.type)
     body = {
         "id":
         id,
         "name":
         name,
         "goodsCategory":
         goodsCategory,
         "maintenanceCategory":
         maintenanceCategory,
         "manufacturerId":
         manufacturerId,
         "minGoodsUnit":
         minGoodsUnit,
         "storageConditions":
         storageConditions,
         "nearExpirationDate":
         nearExpirationDate,
         "origin":
         origin,
         "model":
         model,
         "skuCode":
         skuCode,
         "specification":
         specification,
         "imageSource":
         imageSource,
         "std2012Category":
         std2012Category,
         "registrationUiBeanList": [{
             "longEffect": longEffect,
             "registrationBeginDate": registrationBeginDate,
             "registrationEndDate": registrationEndDate,
             "registrationImg": registrationImg,
             "registrationNum": registrationNum
         }]
     }
     response = request.put_body(url, body)
     # try:
     #     assert response['msg'] == '请求成功'
     # except Exception:
     #     raise response
     return response
コード例 #14
0
def check(adhocOrderId):
    response = request.get('/adhocOrder/getDetailByOrderId?orderId=%s' % adhocOrderId)

    goodsList = response['data']['childUiList'][0]['detailBeanUiList']
    toolsList = response['data']['childUiList'][0]['toolsKitUiBeans']
    deliveryMode = response['data']['adhocOrderUiBean']['deliveryMode']
    warehouseId = response['data']['adhocOrderUiBean']['sourceWarehouse']

    goodsId = jsonpath.jsonpath(goodsList, '$..[*].goodsId')
    quantity = jsonpath.jsonpath(goodsList, '$..[*].quantity')
    kitTemplateId = jsonpath.jsonpath(toolsList, '$..[*].id')
    goods = []
    tools = []

    if goodsId:
        i = 0
        while i < len(goodsId):
            dict = {
                "goodsId": goodsId[i],
                "quantity": quantity[i],
            }
            goods.append(dict)
            i += 1
            if kitTemplateId:
                j = 0
                while j < len(kitTemplateId):
                    dict1 = {
                        "kitTemplateId": kitTemplateId[j],
                        "quantity": 1
                    }
                    tools.append(dict1)
                    j += 1
                body = {
                    "detail": [
                        {
                            "deliveryMode": deliveryMode,
                            "goodsDetailUiBeans": goods,
                            "toolsDetailUiBeans": tools,
                            "warehouseId": warehouseId
                        }
                    ],
                    "id": adhocOrderId
                }
            else:
                body = {
                    "detail": [
                        {
                            "deliveryMode": deliveryMode,
                            "goodsDetailUiBeans": goods,
                            "warehouseId": warehouseId
                        }
                    ],
                    "id": adhocOrderId
                }
    elif kitTemplateId:
        j = 0
        while j < len(kitTemplateId):
            dict1 = {
                "kitTemplateId": kitTemplateId[j],
                "quantity": 1
            }
            tools.append(dict1)
            j += 1
        body = {
            "detail": [
                {
                    "deliveryMode": deliveryMode,
                    "toolsDetailUiBeans": tools,
                    "warehouseId": warehouseId
                }
            ],
            "id": adhocOrderId
        }
    else:
        body = {
            "detail": [
                {
                    "deliveryMode": deliveryMode,
                    "warehouseId": warehouseId
                }
            ],
            "id": adhocOrderId
        }

    check = request.put_body('/adhocOrder/accept', body=body)
    return check
コード例 #15
0
def finishPick(pickOrderId):
    # 根据拣货单id查询详情
    detail = request.get('/pickOrder/detail/%s' % pickOrderId)
    assert detail['msg'] == '请求成功'
    goodsDetail = detail['data']['goodsDetail']
    kitDetail = detail['data']['kitDetail']
    toolsKitDetail = detail['data']['toolsKitDetail']

    # 物资列表
    for goods in goodsDetail:
        # 物资udi
        udi = goods['udi']
        new_udi = re.sub(r'\D', "", udi)
        # 物资编号
        materialCode = goods['materialCode']
        # 货位号
        storageLocationId = goods['storageLocationId']
        # 物资待拣数量
        unpickedQuantity = int(goods['quantity']) - int(
            goods['pickedQuantity'])

        # 扫码获取批号信息
        gs1Decode = request.get('/goods/gs1Decode?code=%s' % new_udi)
        # 序列号
        serialNumber = gs1Decode['data']['serialNumber']
        # 物资id
        goodsId = gs1Decode['data']['goodsId']
        # 批号
        lotNum = gs1Decode['data']['lotNum']
        body = {
            'goodsId': goodsId,
            'lotNum': lotNum,
            'pickOrderId': pickOrderId,
            'serialNumber': serialNumber,
            'storageLocationId': storageLocationId
        }
        # 商品待拣货数量大于1时需多次拣货
        num = 0
        while num < unpickedQuantity:
            pick_response = request.put_body('/pickOrder/picking', body=body)
            assert pick_response['msg'] == '请求成功'
            num += 1
        log.info('物资%s拣货完成' % materialCode)

    # 套包列表 TODO
    for kit in kitDetail:
        print(kit)

    # 工具包列表
    for tools in toolsKitDetail:
        # 工具包条码
        operatorBarcode = tools['operatorBarcode']
        # kitStockId
        kitStockId = tools['kitStockId']
        # 货位号
        storageLocationId = tools['storageLocationId']
        # 物资待拣数量
        unpickedQuantity = int(tools['quantity']) - int(
            tools['pickedQuantity'])

        body = {
            'kitStockId': kitStockId,
            'pickOrderId': pickOrderId,
            'storageLocationId': storageLocationId
        }
        num = 0
        while num < unpickedQuantity:
            pick_response = request.put_body('/pickOrder/picking', body=body)
            assert pick_response['msg'] == '请求成功'
            num += 1
        log.info('工具包%s拣货完成' % operatorBarcode)

    # 完成拣货
    body2 = {
        'pickOrderId':
        pickOrderId,
        'imagePath':
        ['/file/2020/11/16/ac110bd6-ff1f-41ed-b645-a570a8c34df9/提货委托书.jpg']
    }
    finishPick = request.put_body('/pickOrder/pickFinished', body=body2)
    log.info('拣货单完成 %s' % finishPick)
    return finishPick
コード例 #16
0
def edit_order(id,
               goodsId=320,
               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(),
               salesPhone=faker.phone_number(),
               deliveryMode='SELF_PIKE_UP',
               receivingName=faker.name(),
               receivingIdCard=None,
               receivingPhone=faker.phone_number(),
               districtCode=110101000000,
               receivingAddress=faker.address(),
               powerOfAttorney=None,
               consignorName=None,
               consignorPhone=None):
    body = {
        'goodsDetailUiBeans': [],
        'toolsDetailUiBeans': [],
        'orderUiBean': {
            "ageGroup": ageGroup,
            "consignorName": consignorName,
            "consignorPhone": consignorPhone,
            "contactName": contactName,
            "contactPhone": contactPhone,
            "deliveryMode": deliveryMode,
            "districtCode": districtCode,
            "expectReturnTime": expectReturnTime,
            "gender": gender,
            "hospitalName": hospitalName,
            "id": id,
            "manufacturerId": manufacturerId,
            # "payOnDelivery": false,
            "postcode": postcode,
            "powerOfAttorney": powerOfAttorney,
            "procedureSite": [siteId],
            "procedureTime": procedureTime,
            "receivingAddress": receivingAddress,
            "receivingIdCard": receivingIdCard,
            "receivingName": receivingName,
            "receivingPhone": receivingPhone,
            "salesPerson": salesPerson,
            "salesPhone": salesPhone,
            "supplierId": supplierId,
            "surgeon": surgeon
        }
    }
    goods = {'goodsId': goodsId, 'quantity': goodsQuantity}
    body['goodsDetailUiBeans'] = [goods]
    response = request.put_body('/adhocOrder/edit', body=body)
    return response
コード例 #17
0
        ('经销商:审核建议为空', {'approve': None}, '请选择审核或者驳回调拨单'),
        ('经销商:驳回理由为空', {'approve': False, 'rejectReason': None}, '当前用户不可接单'),
        ('经销商:驳回理由超长', {'approve': False, 'rejectReason': context}, '拒绝原因超出长度限制'),
    ]

    @pytest.mark.parametrize('title,case,expected', data)
    @allure.title('{title}')
    def test_approve(self, title, case, expected, AllocateOrder_get_Id):
        url = '/allocateOrder/approve'
        body = {
            "approve": None,
            "id": AllocateOrder_get_Id,
            "rejectReason": None
        }
        body = request.reValue(body, case)
        response = request.put_body(url, body)
        assert response['msg'] == expected

    data = [
        ('供应商:调拨单ID为空', {'id': None}, '请选择调拨单'),
        ('供应商:审核建议为空', {'approve': None}, '请选择审核或者驳回调拨单'),
        ('供应商:驳回理由为空', {'approve': False, 'rejectReason': None}, '请输入修改建议'),
        ('供应商:驳回理由超长', {'approve': False, 'rejectReason': context}, '拒绝原因超出长度限制'),
    ]

    @pytest.mark.parametrize('title,case,expected', data)
    @allure.title('{title}')
    def test_approve01(self, title, case, expected, AllocateOrder_get_Id):
        url = '/allocateOrder/approve'
        body = {
            "approve": None,