Skip to content

Commit 07532e0

Browse files
defaultthreewzl521JqLiu123longJJ2016yekai1003
authored
更正返回值,优化排版 (#88)
* 自定义任务40-基于区块链的分级诊疗数据共享案例分析 (#83) * DevSecretBallot (#86) * longjj2016 (#78) 1.修改之前问题,改为以下方法 10进制ascii转字符串 16进制ascii转字符串 2.文档描述更新 * 添加剪刀石头布的合约玩法 (#79) * add solidity file * add tutorial * add basic solidity tutorials * add assets * divergence * add divergence game * 增加func_call_contract.sol 及doc (#80) * Base64编解码库 (#81) * Counter: SimpleCounter; MultiSigCounter (#82) * 32 医疗卫生合约通用模版 (#84) * #32 医疗卫生合约模版 * 完善#32 医疗合约模版 * Solidity开发教程进阶版 (#85) * add solidity file * add tutorial * add basic solidity tutorials * add assets * divergence * add divergence game * advance solidity tutorial init * solidity tutorial advance Co-authored-by: longJJ2016 <1017303686@qq.com> Co-authored-by: 高野 <yekai1003@163.com> Co-authored-by: itherunder <61953384+itherunder@users.noreply.github.com> Co-authored-by: Kesling <43846775+Kesling515@users.noreply.github.com> Co-authored-by: kimroniny <1301862177@qq.com> Co-authored-by: Ferwoo <wufeiphil@163.com> * 更正返回值,优化排版 getTraceInfo 意为返回溯源信息而不是商品合约地址。 Co-authored-by: wzl521 <63525530+wzl521@users.noreply.github.com> Co-authored-by: JqLiu123 <85717832+JqLiu123@users.noreply.github.com> Co-authored-by: longJJ2016 <1017303686@qq.com> Co-authored-by: 高野 <yekai1003@163.com> Co-authored-by: itherunder <61953384+itherunder@users.noreply.github.com> Co-authored-by: Kesling <43846775+Kesling515@users.noreply.github.com> Co-authored-by: kimroniny <1301862177@qq.com> Co-authored-by: Ferwoo <wufeiphil@163.com>
1 parent 20cf367 commit 07532e0

File tree

11 files changed

+98
-17
lines changed

11 files changed

+98
-17
lines changed

contracts/business_template/traceability/TraceabilityFactory.sol

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
pragma solidity ^0.4.25;
2+
pragma experimental ABIEncoderV2;
23

34
import "./Traceability.sol";
45

@@ -9,10 +10,10 @@ contract TraceabilityFactory{
910
}
1011
mapping(bytes32=>GoodsTrace) private _goodsCategory;
1112

12-
event newTraceEvent(bytes32 goodsGroup);
13+
event newTraceEvent(bytes32 goodsGroup);
1314

14-
//Create traceability commodity category
15-
function createTraceability(bytes32 goodsGroup)public returns(Traceability) {
15+
//Create traceability commodity category
16+
function createTraceability(bytes32 goodsGroup) public returns(Traceability) {
1617
require(!_goodsCategory[goodsGroup].valid,"The trademark already exists" );
1718
Traceability category = new Traceability(goodsGroup);
1819
_goodsCategory[goodsGroup].valid = true;
@@ -21,32 +22,32 @@ contract TraceabilityFactory{
2122
return category;
2223
}
2324

24-
function getTraceability(bytes32 goodsGroup)private view returns(Traceability) {
25-
require(_goodsCategory[goodsGroup].valid,"The trademark has not exists" );
26-
return _goodsCategory[goodsGroup].trace;
25+
function getTraceability(bytes32 goodsGroup) private view returns(Traceability) {
26+
require(_goodsCategory[goodsGroup].valid,"The trademark has not exists" );
27+
return _goodsCategory[goodsGroup].trace;
2728
}
2829
//Create traceability products
29-
function createTraceGoods(bytes32 goodsGroup, uint64 goodsId)public returns(Goods) {
30+
function createTraceGoods(bytes32 goodsGroup, uint64 goodsId) public returns(Goods) {
3031
Traceability category = getTraceability(goodsGroup);
31-
return category.createGoods(goodsId);
32+
return category.createGoods(goodsId);
3233
}
3334

3435
//Change product status
35-
function changeTraceGoods(bytes32 goodsGroup, uint64 goodsId, int16 goodsStatus, string memory remark)public{
36-
Traceability category = getTraceability(goodsGroup);
37-
category.changeGoodsStatus(goodsId, goodsStatus, remark);
36+
function changeTraceGoods(bytes32 goodsGroup, uint64 goodsId, int16 goodsStatus, string memory remark) public {
37+
Traceability category = getTraceability(goodsGroup);
38+
category.changeGoodsStatus(goodsId, goodsStatus, remark);
3839
}
3940

4041
//Query the current status of goods
41-
function getStatus(bytes32 goodsGroup, uint64 goodsId)public view returns(int16){
42-
Traceability category = getTraceability(goodsGroup);
43-
return category.getStatus(goodsId);
42+
function getStatus(bytes32 goodsGroup, uint64 goodsId) public view returns(int16) {
43+
Traceability category = getTraceability(goodsGroup);
44+
return category.getStatus(goodsId);
4445
}
4546

4647
//The whole process of querying goods
47-
function getTraceInfo(bytes32 goodsGroup, uint64 goodsId)public view returns(Goods){
48-
Traceability category = getTraceability(goodsGroup);
49-
return category.getGoods(goodsId);
48+
function getTraceInfo(bytes32 goodsGroup, uint64 goodsId) public view returns(Goods.TraceData[]) {
49+
Traceability category = getTraceability(goodsGroup);
50+
return category.getGoods(goodsId).getTraceInfo();
5051
}
5152

5253
function getGoodsGroup(string memory name) public pure returns (bytes32) {

docs/medicalCase/assets/1.png

244 KB
Loading

docs/medicalCase/assets/2.png

283 KB
Loading

docs/medicalCase/assets/3.png

157 KB
Loading

docs/medicalCase/assets/4.png

258 KB
Loading

docs/medicalCase/assets/5.png

177 KB
Loading

docs/medicalCase/assets/6.png

507 KB
Loading

docs/medicalCase/assets/7.png

151 KB
Loading

docs/medicalCase/assets/8.png

167 KB
Loading

docs/medicalCase/assets/9.png

138 KB
Loading

0 commit comments

Comments
 (0)