def test_cpPurchaseRequestOverproof(self, gettokenfixture, auditFlag,
                                     expect):
     s = gettokenfixture
     self.log.info("----采购申请配额超标审核----")
     r = SRMBase(s)
     uid = r.srm_uuid()
     r.cpLackMaterialSub_Temp(uid, code="105000007", demand=401)  # 超标采购申请新增
     msg = r.cpLackMaterialSub_push(uid, caigouyuan="zhongzijian")
     result = msg[0]
     self.log.info("获取新增结果{}".format(result.json()))
     try:
         msg_getRequestid = r.cp_zdpage(key="materialCode",
                                        value="105000007")  # 查询目标采购申请
         Requestid = jsonpath.jsonpath(msg_getRequestid.json(),
                                       '$..purchaseRequestId')[0]
         Detailid = jsonpath.jsonpath(msg_getRequestid.json(),
                                      '$..requestDetailId')[0]
         self.log.info("获取采购申请ID:%s" % Requestid)
     except:
         self.log.error("获取采购申请数据错误")
     msg_allotDty = r.cp_zdallotDty(Requestid, Detailid)  # 分配采购申请
     Alloid = msg_allotDty.json()["data"][0]
     commit = r.cp_zdcomits(Requestid, Detailid, Alloid)  #分配页面提交
     sql = "UPDATE BUSINESS_WAIT_APPROVE_RECORD SET APPROVE_BY = 'zhongzijian' WHERE PROCESS_NAME = '采购申请超标审批流'"
     Db_Oracle().update(sql)
     page = r.cp_customPage("materialCode", "105000007")
     auditid = jsonpath.jsonpath(page.json(), '$..requestOverproofId')[0]
     purchaseRequestNo = jsonpath.jsonpath(page.json(),
                                           '$..purchaseRequestNo')[0]
     msg = r.cp_audit(auditid, auditFlag)
     self.log.info("审核结果是:%s" % msg.json())
     ass = r.cp_examineRecordsPg("purchaseRequestNo", purchaseRequestNo)
     status = jsonpath.jsonpath(ass.json(), '$..status')[0]
     assert status == expect
 def test_cpLackMaterialSub_push(self, gettokenfixture, code, caigouyuan,
                                 expect):
     s = gettokenfixture
     self.log.info("----采购申请提交接口----")
     r = SRMBase(s)
     uid = r.srm_uuid()
     r.cpLackMaterialSub_Temp(uid, code, demand=1)
     msg = r.cpLackMaterialSub_push(uid, caigouyuan)
     result = msg[0]
     self.log.info("获取请求结果{}".format(result.json()))
     uu = msg[1]
     ass_uu = r.cpLackMaterialSub_page("remark", uu)
     ass_remark = jsonpath.jsonpath(ass_uu.json(), '$..remark')[0]
     assert result.json()["success"] == 1
     assert result.status_code == 200
     assert ass_remark == "{}".format(uu)