Commit a4acf88d657d76d7f1c0652b9bb625c38349ec89

Authored by liujiqiang
1 parent 1f796a60

批号结算

commons/api/hg/settlement/sellingGoods.py
@@ -30,5 +30,222 @@ def queryRegister(session=None,host=None,**kwargs): @@ -30,5 +30,222 @@ def queryRegister(session=None,host=None,**kwargs):
30 res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers) 30 res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
31 return res 31 return res
32 32
33 -res = queryRegister(session=sessionHg,host=host,batchCode="2109000266")  
34 -print(res.json())  
35 \ No newline at end of file 33 \ No newline at end of file
  34 +# res = queryRegister(session=sessionHg,host=host,batchCode="2109000266")
  35 +# print(res.json())
  36 +
  37 +def getBySheetNoAndBizNo(session=None,host=None,bizNo="2109000250"):
  38 + """
  39 + 查询登记单
  40 + :param batchCode:登记单号
  41 + """
  42 + url = host+"/wms-service/api/sheet/manage/getBySheetNoAndBizNo"
  43 + headers = {}
  44 + data = {"bizNo":bizNo}
  45 + res = session.useHeadersRequests(method="get",url=url,params=data,headers=headers)
  46 + return res
  47 +
  48 +# res = getBySheetNoAndBizNo(session=sessionHg,host=host,bizNo="2109000250")
  49 +# print(res.json())
  50 +
  51 +def getArea(session=None,host=None,**kwargs):
  52 + """
  53 + 查询登记单
  54 + :param batchCode:登记单号
  55 + """
  56 + url = host+"/assets-service/api/district/search"
  57 + headers = dct.jsonCode()
  58 + data = {"id":272,"marketId":15,"departmentId":177}
  59 + data = dict(data,**kwargs)
  60 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  61 + return res
  62 +
  63 +# res = getArea(session=sessionHg,host=host,bizNo="2109000250")
  64 +# print(res.json())
  65 +
  66 +def validateReduce(session=None,host=None,**kwargs):
  67 + """
  68 + 查询登记单
  69 + :param batchCode:登记单号
  70 + """
  71 + url = host+"/wms-service/api/sheet/manage/validateReduce"
  72 + headers = dct.jsonCode()
  73 + data = {"bizNo":"2109000250","firmId":15,"kid":36,"weight":50}
  74 + data = dict(data,**kwargs)
  75 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  76 + return res
  77 +
  78 +# res = validateReduce(session=sessionHg,host=host,bizNo="2109000250")
  79 +# print(res.json())
  80 +
  81 +def listByExample(session=None,host=None,**kwargs):
  82 + """
  83 + 查询登记单
  84 + :param IsEnable:是否可用
  85 + :param MarketId:登记单号
  86 + :param BusinessType:身份类型,hg_trading_buyer,hg_trading_seller
  87 + """
  88 + url = host+"/assets-service/api/businessChargeItem/listByExample"
  89 + headers = dct.jsonCode()
  90 + data = {"IsEnable":1,"MarketId":15,"BusinessType":"hg_trading_buyer"}
  91 + data = dict(data,**kwargs)
  92 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  93 + return res
  94 +
  95 +# res = listByExample(session=sessionHg,host=host,bizNo="2109000250")
  96 +# print(res.json())
  97 +
  98 +
  99 +def queryFee(session=None,host=None,**kwargs):
  100 + """
  101 + 查询登记单
  102 + :param batchCode:登记单号
  103 + """
  104 + url = host+"/dili-rule/api/chargeRule/queryFee"
  105 + headers = dct.jsonCode()
  106 + data = {"marketId": 15, "businessType": "hg_trading_buyer", "chargeItem": 521, "calcParams": {"amount": 150.0},
  107 + "conditionParams": {"payment": 150.0, "categoryId": 754107}}
  108 + data = dict(data,**kwargs)
  109 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  110 + return res
  111 +
  112 +# res = queryFee(session=sessionHg,host=host)
  113 +# print(res.json())
  114 +
  115 +def get_simpleInfo(session=None,host=None,ic="888800010592"):
  116 + url = host+"/account-service/api/account/simpleInfo"
  117 + headers=dct.jsonCode()
  118 + data={"cardNo":ic}
  119 + res = session.useHeadersRequests(method="GET",url=url,params=data,headers=headers)
  120 + return res
  121 +
  122 +# res = get_simpleInfo(session=sessionHg,host=host,ic="888800010592")
  123 +# print(res.text)
  124 +
  125 +def getCustomerInfoExpireState(session=None,host=None,customerId="141963"):
  126 + url = host+"/customer-service/api/customerMarket/getCustomerInfoExpireState"
  127 + headers=dct.jsonCode()
  128 + data={"customerId":customerId}
  129 + res = session.useHeadersRequests(method="post",url=url,params=data,headers=headers)
  130 + return res
  131 +
  132 +# res = getCustomerInfoExpireState(session=sessionHg,host=host,customerId="141963")
  133 +# print(res.text)
  134 +
  135 +
  136 +def createAndTrade(session=None,host=None,**kwargs):
  137 + url = host+"/hg-trading/api/tradingOrder/createAndTrade"
  138 + headers=dct.jsonCode()
  139 + data = {"sellerId": 142000, "sellerName": "史东晶", "sellerAccountId": 107796, "sellerCardNo": "888800010591",
  140 + "buyerId": 141963, "buyerName": "杭果客户长歌一", "buyerAccountId": 107667, "buyerCardNo": "888800010592",
  141 + "posCode": "123", "tradePassword": "111111", "orderItemList": [
  142 + {"number": 0, "batchCode": "2109000262", "productId": 36, "productCode": "754107", "productName": "葡萄",
  143 + "categoryId": 754107, "weightType": 2, "quantity": 1, "pieceWeight": None, "grossWeight": 0,
  144 + "tareWeight": 0, "weight": 50, "price": 200, "PriceStr": "2", "amount": 10000, "amountStr": 100.0,
  145 + "originId": 500101, "originName": "万州区",
  146 + "feeItemList": [{"type": 1, "chargeItemId": 521, "chargeItemName": "买家手续费", "amount": 1122.00},
  147 + {"type": 2, "chargeItemId": 522, "chargeItemName": "卖家手续费", "amount": 610.0},
  148 + {"type": 2, "chargeItemId": 527, "chargeItemName": "卖家仓储服务费", "amount": 522.00}]}]}
  149 + data = rJD.replaceJsonData(json=data,data=kwargs)
  150 + res = session.useHeadersRequests(method="post",url=url,data=json.dumps(data),headers=headers)
  151 + return res
  152 +
  153 +# res = createAndTrade(session=sessionHg,host=host)
  154 +# print(res.text)
  155 +
  156 +def doCreateAndTrade(session=None,host=None,batchCode=None,weight="50",PriceStr="2",posCode="123",tradePassword="111111",
  157 + ic="888800010592"):
  158 + # 获取订单信息
  159 + resQuery = queryRegister(session=session,host=host,batchCode=batchCode)
  160 + # print(resQuery.json())
  161 +
  162 + # 订单信息中提取卖家信息
  163 + sellerId = resQuery.json()["data"][0]["registerRecord"]["customerId"]
  164 + sellerName = resQuery.json()["data"][0]["registerRecord"]["customerName"]
  165 + sellerAccountId = resQuery.json()["data"][0]["registerRecord"]["accountId"]
  166 + sellerCardNo = resQuery.json()["data"][0]["registerRecord"]["cardNo"]
  167 + posCode=posCode
  168 + tradePassword=tradePassword
  169 +
  170 + # 订单信息中提取商品信息
  171 + productId = resQuery.json()["data"][0]["product"]["id"]
  172 + productCode = resQuery.json()["data"][0]["product"]["categoryCode"]
  173 + productName = resQuery.json()["data"][0]["product"]["categoryName"]
  174 + categoryId = resQuery.json()["data"][0]["product"]["categoryId"]
  175 + originId = resQuery.json()["data"][0]["product"]["originId"]
  176 + originName = resQuery.json()["data"][0]["product"]["originName"]
  177 +
  178 +
  179 + # 获取信息
  180 + res = getBySheetNoAndBizNo(session=session,host=host,bizNo=batchCode)
  181 + # print(res.json())
  182 +
  183 +
  184 + # 打印客户信息
  185 + id = resQuery.json()["data"][0]["registerDetail"]["areaId"]
  186 + departmentId = session.userInfo["data"]["user"]["departmentId"]
  187 + marketId = session.userInfo["data"]["user"]["firmId"]
  188 + resArea = getArea(session=session,host=host,id=id,departmentId=departmentId,marketId=marketId)
  189 + print(resArea.json())
  190 +
  191 + # 称重信息
  192 + weightType = resQuery.json()["data"][0]["registerDetail"]["weightType"]
  193 + weight=weight
  194 + PriceStr = PriceStr
  195 + price = int(float(PriceStr)*100)
  196 + amount = int(float(weight)*price)
  197 + amountStr = str(float(amount)/100)
  198 +
  199 + # 判断库存
  200 + resValidate = validateReduce(session=session,host=host,bizNo=batchCode,firmId=marketId,kid=productId,weight=weight)
  201 + # print(resValidate.json())
  202 +
  203 + # 费用信息获取,初始化费用信息
  204 + feeItemList=[]
  205 +
  206 + # 买家身份费用获取
  207 + BusinessType = "hg_trading_buyer"
  208 + resExample = listByExample(session=session,host=host,marketId=marketId,BusinessType=BusinessType)
  209 + chargeItemList = [i["id"] for i in resExample.json()["data"]]
  210 + for item in chargeItemList:
  211 + res = queryFee(session=session,host=host,businessType=BusinessType,marketId=marketId,chargeItem=item,
  212 + amount=amount,payment=amount,categoryId=categoryId)
  213 + feeItem = {}
  214 + feeItem["type"]=1
  215 + feeItem["chargeItemId"]=item
  216 + feeItem["chargeItemName"]=[i["chargeItem"] for i in resExample.json()["data"] if i["id"] == item][0]
  217 + feeItem["amount"]=float(res.json()["data"]["totalFee"])*100
  218 + feeItemList.append(feeItem)
  219 +
  220 + # 卖家费用获取
  221 + BusinessType = "hg_trading_seller"
  222 + resExample = listByExample(session=session,host=host,marketId=marketId,BusinessType=BusinessType)
  223 + chargeItemList = [i["id"] for i in resExample.json()["data"]]
  224 + for item in chargeItemList:
  225 + res = queryFee(session=session,host=host,businessType=BusinessType,marketId=marketId,chargeItem=item,
  226 + amount=amount,payment=amount,categoryId=categoryId)
  227 + feeItem = {}
  228 + feeItem["type"]=2
  229 + feeItem["chargeItemId"]=item
  230 + feeItem["chargeItemName"]=[i["chargeItem"] for i in resExample.json()["data"] if i["id"] == item][0]
  231 + feeItem["amount"]=float(res.json()["data"]["totalFee"])*100
  232 + feeItemList.append(feeItem)
  233 + print(feeItemList)
  234 +
  235 + # 获取买家信息
  236 + resSimpleInfo = get_simpleInfo(session=session,host=host,ic=ic)
  237 + # print(resSimpleInfo.json())
  238 + buyerId = resSimpleInfo.json()["data"]["accountInfo"]["customerId"]
  239 + buyerName = resSimpleInfo.json()["data"]["accountInfo"]["customerName"]
  240 + buyerAccountId = resSimpleInfo.json()["data"]["accountInfo"]["accountId"]
  241 + buyerCardNo = resSimpleInfo.json()["data"]["accountInfo"]["cardNo"]
  242 +
  243 + resCAT = createAndTrade(session=session,host=host,sellerId=sellerId,sellerName=sellerName,sellerAccountId=sellerAccountId,
  244 + sellerCardNo=sellerCardNo,posCode=posCode,tradePassword=tradePassword,productId=productId,
  245 + productCode=productCode,productName=productName,categoryId=categoryId,originId=originId,
  246 + originName=originName,weightType=weightType,weight=weight,PriceStr=PriceStr,price=price,
  247 + amount=amount,amountStr=amountStr,batchCode=batchCode,buyerId=buyerId,
  248 + buyerName=buyerName,buyerAccountId=buyerAccountId,buyerCardNo=buyerCardNo,feeItemList=feeItemList)
  249 + return resCAT
  250 +
  251 +# res = doCreateAndTrade(session=sessionHg,host=host,batchCode="2109000289",ic="888800010592")
  252 +# print(res.text)
36 \ No newline at end of file 253 \ No newline at end of file
commons/scripts/replaceJsonData.py
@@ -19,4 +19,11 @@ def replaceJsonData(json={},data={}): @@ -19,4 +19,11 @@ def replaceJsonData(json={},data={}):
19 for list_child_index in range(len(json[i])): 19 for list_child_index in range(len(json[i])):
20 if type(json[i][list_child_index]) == dict: 20 if type(json[i][list_child_index]) == dict:
21 json[i][list_child_index] = replaceJsonData(json=json[i][list_child_index], data=data) 21 json[i][list_child_index] = replaceJsonData(json=json[i][list_child_index], data=data)
22 - return json  
23 \ No newline at end of file 22 \ No newline at end of file
  23 + else:
  24 + if i in data.keys():
  25 + json[i] = data[i]
  26 + return json
  27 +
  28 +json = {"a":"1","b":[{"c":"1"},{"c":2}],"d":[1],"e":"1","f":{"g":1},"h":1,"i":[1]}
  29 +data = {"a":"a","c":"c","e":"e","d": {"d1":"d1"},"g":"g","h":"h"}
  30 +print(replaceJsonData(json=json,data=data))
24 \ No newline at end of file 31 \ No newline at end of file
config/marketConfig/conf_test.conf
@@ -13,6 +13,7 @@ hd_cardNumRe_01=210823173732 @@ -13,6 +13,7 @@ hd_cardNumRe_01=210823173732
13 #hg 13 #hg
14 hg_cardNumRe_01=888800010591 14 hg_cardNumRe_01=888800010591
15 hg_cardNumRe_02=888800010592 15 hg_cardNumRe_02=888800010592
  16 +hg_posCode_01=123
16 17
17 18
18 [host] 19 [host]
report/test.log
1 -[2021-09-10 11:18:07] [INFO] : ======================================================================================  
2 -[2021-09-10 11:18:07] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb  
3 -[2021-09-10 11:18:07] [INFO] : http://10.28.12.150:80/api/authenticationApi/loginWeb  
4 -{'data': None, 'json': {'userName': '111222', 'password': 'HgXZPyFq/MmgAGgi+yghB+PkqkZ2mCl3P5pS61n4LvwFIGfClsQBjUfonZc6M+LdAdQozqg073HtWsZdabvM2IqNJ+DmxDQSfW/9kS2UovsVE739RaPT2aH/0MKgQ3EvpYdN5mYQ1vD2Dm+avuEXEMPzyfQjOaH6qb0i1Ro2DQA='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}}  
5 -  
6 -[2021-09-10 11:18:07] [INFO] : ======================================================================================  
7 -[2021-09-10 11:18:07] [INFO] : http://test.uap.diligrp.com/login/login.action  
8 -[2021-09-10 11:18:07] [INFO] : http://10.28.12.150:80/login/login.action 1 +[2021-09-13 11:09:46] [INFO] : ======================================================================================
  2 +[2021-09-13 11:09:46] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb
  3 +[2021-09-13 11:09:46] [INFO] : http://10.28.12.150:80/api/authenticationApi/loginWeb
  4 +{'data': None, 'json': {'userName': '111222', 'password': 'DRocye2VphU1vrI4H1ZDG5qpLaH+J4W433PIxukTeIDZeOmpK1CN+rXZwea+mhasHAxVtB1D8Vvgr23aMl8M/iQ4fyvpDREfekEkegwMlq4xK7WgvVkMHpRCWYkf1P6kv3NoyCuOMtq+dHDJM755kXXwfTzKouXrUUOU9Nq3IcI='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}}
  5 +
  6 +[2021-09-13 11:09:46] [INFO] : ======================================================================================
  7 +[2021-09-13 11:09:46] [INFO] : http://test.uap.diligrp.com/login/login.action
  8 +[2021-09-13 11:09:46] [INFO] : http://10.28.12.150:80/login/login.action
9 {'data': b'userName=111222&password=111111', 'json': None, 'headers': {'Host': 'test.uap.diligrp.com', 'Connection': 'keep-alive', 'Content-Length': '33', 'Cache-Control': 'max-age=0', 'Upgrade-Insecure-Requests': '1', 'Origin': 'http://test.uap.diligrp.com', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/90.0.4430.212Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Referer': 'http://test.uap.diligrp.com/login/index.html', 'Accept-Encoding': 'gzip,deflate', 'Accept-Language': 'zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7', 'Cookie': 'UAP_accessToken=;UAP_refreshToken=;UAP_loginPath='}, 'allow_redirects': False} 9 {'data': b'userName=111222&password=111111', 'json': None, 'headers': {'Host': 'test.uap.diligrp.com', 'Connection': 'keep-alive', 'Content-Length': '33', 'Cache-Control': 'max-age=0', 'Upgrade-Insecure-Requests': '1', 'Origin': 'http://test.uap.diligrp.com', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/90.0.4430.212Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Referer': 'http://test.uap.diligrp.com/login/index.html', 'Accept-Encoding': 'gzip,deflate', 'Accept-Language': 'zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7', 'Cookie': 'UAP_accessToken=;UAP_refreshToken=;UAP_loginPath='}, 'allow_redirects': False}
10 10
11 -[2021-09-10 11:18:07] [INFO] : ======================================================================================  
12 -[2021-09-10 11:18:07] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/registerRecord/queryRegister  
13 -{"recordQueryDto": {"batchCode": "2109000266"}} 11 +[2021-09-13 11:09:46] [INFO] : ======================================================================================
  12 +[2021-09-13 11:09:46] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/businessChargeItem/listBusinessChargeItem
  13 +{"marketId": 15, "businessType": "501"}
  14 +{}
  15 +
  16 +[2021-09-13 11:09:46] [INFO] : ======================================================================================
  17 +[2021-09-13 11:09:46] [INFO] : http://test.gateway.diligrp.com:8285/card-web/accountQuery/simpleInfo.action
  18 +None
  19 +{'params': {'cardNo': '888800010591'}}
  20 +
  21 +[2021-09-13 11:09:46] [INFO] : ======================================================================================
  22 +[2021-09-13 11:09:46] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree
  23 +{"marketId": 15, "keyword": "\u8461\u8404", "state": 1}
  24 +{}
  25 +
  26 +[2021-09-13 11:09:46] [INFO] : ======================================================================================
  27 +[2021-09-13 11:09:46] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/city/listByKeywordsWithCityCode
  28 +{"allLevelKeyword": "\u4e07\u5dde"}
  29 +{}
  30 +
  31 +[2021-09-13 11:09:46] [INFO] : ======================================================================================
  32 +[2021-09-13 11:09:46] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/district/search
  33 +{"marketId": 15, "nameLike": "\u897f\u533a"}
  34 +{}
  35 +
  36 +[2021-09-13 11:09:46] [INFO] : ======================================================================================
  37 +[2021-09-13 11:09:46] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee
  38 +{"businessType": "501", "chargeItem": 518, "marketId": 15}
  39 +{}
  40 +
  41 +[2021-09-13 11:09:46] [INFO] : ======================================================================================
  42 +[2021-09-13 11:09:46] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee
  43 +{"businessType": "501", "chargeItem": 520, "marketId": 15}
  44 +{}
  45 +
  46 +[2021-09-13 11:09:47] [INFO] : ======================================================================================
  47 +[2021-09-13 11:09:47] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/registerRecord/save
  48 +{"accountId": 107796, "cardNo": "888800010591", "customerId": 142000, "customerCode": "00131702", "customerName": "\u53f2\u4e1c\u6676", "fixedphoneNumber": null, "mobilephoneNumber": "18080008020", "identityCardAddress": "", "identityCardNo": "110101202109024587", "identityCardType": "ID", "registerDetailDtoList": [{"id": 0, "areaId": 272, "areaName": "\u897f\u533a", "quantity": 0, "productId": 754107, "registerRecordId": 0, "remark": null, "weight": 100, "weightType": 0, "created": null, "createdById": 0, "createdByName": null, "createdByDepartmentId": 0, "createdByDepartmentName": null, "registerCertificateList": null, "product": null, "registerCertificateDtoList": null, "productDto": {"id": 0, "originId": 500101, "originName": "\u4e07\u5dde\u533a", "pieceWeight": 0, "categoryId": 754107, "categoryCode": 754107, "categoryName": "\u8461\u8404", "created": null}}], "registerFeeDtoList": [{"id": 0, "actualFee": 200, "receivableFee": 1300, "discountFee": 1100, "registerRecordId": 0, "payStatus": 0, "chargeItemName": "\u5176\u4ed6\u6536\u8d39", "chargeType": 1, "chargeItemId": 518, "registerFeeType": 999, "created": null, "createdById": 0, "createdByName": null, "settleDate": null, "isBehalf": 0, "registerLoadingFeeExtDto": null}], "tradePassword": "111111"}
  49 +{}
  50 +
  51 +[2021-09-13 11:09:48] [INFO] : ======================================================================================
  52 +[2021-09-13 11:09:48] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/registerRecord/queryRegister
  53 +{"recordQueryDto": {"batchCode": "2109000298"}}
  54 +{}
  55 +
  56 +[2021-09-13 11:09:48] [INFO] : ======================================================================================
  57 +[2021-09-13 11:09:48] [INFO] : http://test.gateway.diligrp.com:8285/wms-service/api/sheet/manage/getBySheetNoAndBizNo
  58 +None
  59 +{'params': {'bizNo': '2109000298'}}
  60 +
  61 +[2021-09-13 11:09:48] [INFO] : ======================================================================================
  62 +[2021-09-13 11:09:48] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/district/search
  63 +{"id": 272, "marketId": 15, "departmentId": 177}
  64 +{}
  65 +
  66 +[2021-09-13 11:09:48] [INFO] : ======================================================================================
  67 +[2021-09-13 11:09:48] [INFO] : http://test.gateway.diligrp.com:8285/wms-service/api/sheet/manage/validateReduce
  68 +{"bizNo": "2109000298", "firmId": 15, "kid": "36", "weight": "50"}
  69 +{}
  70 +
  71 +[2021-09-13 11:09:48] [INFO] : ======================================================================================
  72 +[2021-09-13 11:09:48] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/businessChargeItem/listByExample
  73 +{"IsEnable": 1, "MarketId": 15, "BusinessType": "hg_trading_buyer", "marketId": 15}
  74 +{}
  75 +
  76 +[2021-09-13 11:09:48] [INFO] : ======================================================================================
  77 +[2021-09-13 11:09:48] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee
  78 +{"marketId": 15, "businessType": "hg_trading_buyer", "chargeItem": 521, "calcParams": {"amount": 150.0}, "conditionParams": {"payment": 150.0, "categoryId": 754107}, "amount": 10000, "payment": 10000, "categoryId": 754107}
  79 +{}
  80 +
  81 +[2021-09-13 11:09:48] [INFO] : ======================================================================================
  82 +[2021-09-13 11:09:48] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/businessChargeItem/listByExample
  83 +{"IsEnable": 1, "MarketId": 15, "BusinessType": "hg_trading_seller", "marketId": 15}
  84 +{}
  85 +
  86 +[2021-09-13 11:09:48] [INFO] : ======================================================================================
  87 +[2021-09-13 11:09:48] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee
  88 +{"marketId": 15, "businessType": "hg_trading_seller", "chargeItem": 522, "calcParams": {"amount": 150.0}, "conditionParams": {"payment": 150.0, "categoryId": 754107}, "amount": 10000, "payment": 10000, "categoryId": 754107}
  89 +{}
  90 +
  91 +[2021-09-13 11:09:49] [INFO] : ======================================================================================
  92 +[2021-09-13 11:09:49] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee
  93 +{"marketId": 15, "businessType": "hg_trading_seller", "chargeItem": 527, "calcParams": {"amount": 150.0}, "conditionParams": {"payment": 150.0, "categoryId": 754107}, "amount": 10000, "payment": 10000, "categoryId": 754107}
  94 +{}
  95 +
  96 +[2021-09-13 11:09:49] [INFO] : ======================================================================================
  97 +[2021-09-13 11:09:49] [INFO] : http://test.gateway.diligrp.com:8285/account-service/api/account/simpleInfo
  98 +None
  99 +{'params': {'cardNo': '888800010592'}}
  100 +
  101 +[2021-09-13 11:09:49] [INFO] : ======================================================================================
  102 +[2021-09-13 11:09:49] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/tradingOrder/createAndTrade
  103 +{"sellerId": 142000, "sellerName": "\u53f2\u4e1c\u6676", "sellerAccountId": 107796, "sellerCardNo": "888800010591", "buyerId": 141963, "buyerName": "\u676d\u679c\u5ba2\u6237\u957f\u6b4c\u4e00", "buyerAccountId": 107667, "buyerCardNo": "888800010592", "posCode": "123", "tradePassword": "111111", "orderItemList": [{"number": 0, "batchCode": "2109000298", "productId": "36", "productCode": "754107", "productName": "\u8461\u8404", "categoryId": 754107, "weightType": 2, "quantity": 1, "pieceWeight": null, "grossWeight": 0, "tareWeight": 0, "weight": "50", "price": 200, "PriceStr": "2", "amount": 10000, "amountStr": "100.0", "originId": 500101, "originName": "\u4e07\u5dde\u533a", "feeItemList": [{"type": 1, "chargeItemId": 521, "chargeItemName": "\u4e70\u5bb6\u624b\u7eed\u8d39", "amount": 10000}, {"type": 2, "chargeItemId": 522, "chargeItemName": "\u5356\u5bb6\u624b\u7eed\u8d39", "amount": 10000}, {"type": 2, "chargeItemId": 527, "chargeItemName": "\u5356\u5bb6\u4ed3\u50a8\u670d\u52a1\u8d39", "amount": 10000}]}]}
14 {} 104 {}
15 105
testcase/hg/test_batchSettlement/test_batchSettlement.py
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 from commons.MySession import sessionHg as session 12 from commons.MySession import sessionHg as session
13 from commons.api.hg.CheckIn import CheckIn 13 from commons.api.hg.CheckIn import CheckIn
14 from commons.api.hg.settlement import batch 14 from commons.api.hg.settlement import batch
  15 +from commons.api.hg.settlement import sellingGoods
15 from commons.scripts.readConf import rC 16 from commons.scripts.readConf import rC
16 import unittest,random 17 import unittest,random
17 18
@@ -28,6 +29,8 @@ class test_batch(unittest.TestCase): @@ -28,6 +29,8 @@ class test_batch(unittest.TestCase):
28 cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost") 29 cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost")
29 cls.jmsfHost = rC.returnOptionsItems("host", "jmsfHost") 30 cls.jmsfHost = rC.returnOptionsItems("host", "jmsfHost")
30 cls.ic = rC.returnOptionsItems("testInfo", "hg_cardNumRe_01") 31 cls.ic = rC.returnOptionsItems("testInfo", "hg_cardNumRe_01")
  32 + cls.ic_buyer = rC.returnOptionsItems("testInfo", "hg_cardNumRe_02")
  33 + cls.posCode = rC.returnOptionsItems("testInfo", "hg_posCode_01")
31 34
32 @classmethod 35 @classmethod
33 def tearDownClass(cls) -> None: 36 def tearDownClass(cls) -> None:
@@ -38,6 +41,11 @@ class test_batch(unittest.TestCase): @@ -38,6 +41,11 @@ class test_batch(unittest.TestCase):
38 批号管理--查询--输入【在售】状态的完整批号,查询出该批号下的相关数据 41 批号管理--查询--输入【在售】状态的完整批号,查询出该批号下的相关数据
39 """ 42 """
40 # 创建初始数据 43 # 创建初始数据
  44 + posCode = self.posCode
41 resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic) 45 resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
42 - self.batchCode = resBatchCode.json()["data"]["batchCode"]  
43 - print("test_searchState_1 --> self.batchCode:", self.batchCode)  
44 \ No newline at end of file 46 \ No newline at end of file
  47 + batchCode = resBatchCode.json()["data"]["batchCode"]
  48 + print("test_searchState_1 --> self.batchCode:", batchCode)
  49 + resCAT = sellingGoods.doCreateAndTrade(session=session,host=self.gatewayHost,batchCode=batchCode,
  50 + ic=self.ic_buyer,posCode=posCode)
  51 + print(resCAT.json())
  52 + assert resCAT.json()["code"]=="200","登记单交易失败"
45 \ No newline at end of file 53 \ No newline at end of file