bootstrap.php
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
use Carbon\Carbon;
use Lackoxygen\GzCbec\GzCBEC;
use Lackoxygen\GzCbec\Request\Report\CEB311Message;
use Lackoxygen\GzCbec\Request\Report\Node\BaseTransfer;
use Lackoxygen\GzCbec\Request\Report\Node\Order;
use Lackoxygen\GzCbec\Request\Report\Node\OrderHead;
use Lackoxygen\GzCbec\Request\Report\Node\OrderList;
foreach (['./', '../', '../../', '../../../'] as $pathPrefix) {
$loaderFile = $pathPrefix . 'vendor/autoload.php';
if (file_exists($loaderFile)) {
require_once $loaderFile;
break;
}
}
$message = new CEB311Message;
$baseTransfer = new BaseTransfer;
$baseTransfer->setCopCode('copCode');
$baseTransfer->setCopName('copName');
$baseTransfer->setDxpId('dxpId');
$baseTransfer->setDxpMode('DxpMode');
$baseTransfer->setNote('测试');
$order = new Order();
$orderHead = new OrderHead;
$orderHead->setGuid(\Str::uuid()->toString());
$orderHead->setAppTime(Carbon::now()->getPreciseTimestamp(4));
$orderHead->setAppStatus(1);
$orderHead->setAppType(1);
$orderHead->setOrderType(1);
$orderHead->setOrderNo('order20160321116421002');
$orderHead->setEbpCode("C011111100414353");
$orderHead->setEbpName("广东各有所爱信息科技有限公司");
$orderHead->setEbcCode("C011111100414353");
$orderHead->setEbcName("广东各有所爱信息科技有限公司");
$orderHead->setGoodsValue("20");
$orderHead->setFreight("0");
$orderHead->setDiscount("0");
$orderHead->setTaxTotal("0");
$orderHead->setActuralPaid("20");
$orderHead->setCurrency("142");
$orderHead->setBuyerRegNo("9416");
$orderHead->setBuyerName("张文龙");
$orderHead->setBuyerIdType("1");
$orderHead->setBuyerIdNumber("445322199402212519");
$orderHead->setNote("测试");
$orderHead->setPayName("支付宝");
$orderHead->setPayTransactionId("201907311451410688620491");
$orderHead->setBatchNumbers("1232312335");
$orderHead->setConsignee("张文龙");
$orderHead->setConsigneeTelephone("15800019416");
$orderHead->setConsigneeAddress("广东省番禺区天安科技园");
//$orderHead->setConsigneeDistrict("");
//$orderHead->setNote("");
$orderList = new OrderList();
$orderList->setGnum(1);
$orderList->setItemNo('3306');
$orderList->setItemName("日本 SANA莎娜 豆乳乳液-测试-02007381");
$orderList->setItemDescribe('规格:一支装 ');
$orderList->setBarCode('8801046250402');
$orderList->setUnit('007');
$orderList->setQty('1');
$orderList->setPrice(100);
$orderList->setTotalPrice(100);
$orderList->setCurrency('142');
$orderList->setCountry("ABW000");
$order->setOrderHead($orderHead);
$order->pushOrderList($orderList);
$order->pushOrderList($orderList);
$message->setOrder($order);
$message->setBaseTransfer($baseTransfer);
$obj = new GzCBEC();
$xml = $obj->report()->CEB311Message($message);