Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
|
5541bd41b6 | |
|
44fc0defb5 | |
|
e20f6b950e | |
|
8e972bb2dd | |
|
13a3da9b4e | |
![]() |
06a645973e | |
![]() |
9b3913ed60 |
15
README.md
15
README.md
|
@ -26,13 +26,13 @@ $secretKey = 'gFBfirGATxafTeq74RAngaL74Ksdxhuy';
|
|||
|
||||
$options = [
|
||||
'logger' => true,
|
||||
'logs_path' => storage_path('logs/mes-sdk/sdk.log'),
|
||||
'logs_path' => storage_path('logs/mes-sdk'),
|
||||
];
|
||||
|
||||
$w = new Order($secretKey, 'callback url', $options);
|
||||
|
||||
// 获取工单数据
|
||||
$response = $w->getProductOrder('SN5436745676543');
|
||||
$response = $w->getProductOrder(1);
|
||||
|
||||
// 加工工单原木材种
|
||||
$w->getWoodTypeOptions([
|
||||
|
@ -57,6 +57,17 @@ $response = $w->createProductOrder([
|
|||
'number_pcs' => 10,
|
||||
'owner' => 'ykxiao'
|
||||
]);
|
||||
|
||||
// 更新加工工单
|
||||
$response = $w->updateProductOrder([
|
||||
'id' => 1,
|
||||
'company_id' => 1,
|
||||
]);
|
||||
|
||||
// 撤回加工工单
|
||||
$response = $w->revokeProductOrder([
|
||||
'id' => 1
|
||||
]);
|
||||
```
|
||||
|
||||
# 回调说明
|
||||
|
|
|
@ -124,10 +124,10 @@ class Order
|
|||
|
||||
$result = 'json' === self::DEFAULT_FORMAT ? json_decode($response, true) : $response;
|
||||
// 日志
|
||||
$this->logger(['response' => $result]);
|
||||
$this->logger(['request' => $body, 'response' => $result]);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
$this->logger(['response' => $e]);
|
||||
$this->logger(['request' => $body, 'response' => $e]);
|
||||
throw new HttpException($e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
|
@ -136,46 +136,63 @@ class Order
|
|||
* 获取工单信息
|
||||
* @param $order_sn
|
||||
* @return mixed|string
|
||||
* @throws \Exception|GuzzleException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function getProductOrder($order_sn)
|
||||
public function getProductOrder($orderId)
|
||||
{
|
||||
$data = [
|
||||
'order_sn' => $order_sn
|
||||
'id' => $orderId
|
||||
];
|
||||
return $this->sendRequest('production.status', $data);
|
||||
return $this->sendRequest('production.info', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加工工单原木材种
|
||||
* @return mixed|string
|
||||
* @throws GuzzleException
|
||||
* @throws HttpException
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function getWoodTypeOptions($data)
|
||||
{
|
||||
return $this->baseFun($data, 'Wood.types');
|
||||
return $this->sendRequest('Wood.types', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加工等级
|
||||
* @return mixed|string
|
||||
* @throws GuzzleException
|
||||
* @throws HttpException
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function getProductionLevelOptions($data)
|
||||
{
|
||||
return $this->baseFun($data, 'production.levels');
|
||||
return $this->sendRequest('production.levels', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加工工单创建
|
||||
* @return mixed|string
|
||||
* @throws \Exception|GuzzleException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function createProductOrder($data)
|
||||
{
|
||||
return $this->sendRequest('production.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加工工单更新
|
||||
* @return mixed|string
|
||||
* @throws HttpException|GuzzleException
|
||||
*/
|
||||
public function updateProductOrder($data)
|
||||
{
|
||||
return $this->sendRequest('production.update', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加工工单撤回
|
||||
* @return mixed|string
|
||||
* @throws HttpException|GuzzleException
|
||||
*/
|
||||
public function revokeProductOrder($data)
|
||||
{
|
||||
return $this->sendRequest('production.revoke', $data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue