Compare commits

..

7 Commits
v1.0.7 ... dev

Author SHA1 Message Date
hongwenwu 5541bd41b6 获取工单信息 2023-09-11 16:28:44 +08:00
hongwenwu 44fc0defb5 获取工单信息 2023-09-11 16:27:48 +08:00
hongwenwu e20f6b950e 获取工单信息 2023-09-11 13:53:27 +08:00
hongwenwu 8e972bb2dd Merge branch 'dev' of https://git.tool.dwoodauto.com/ykxiao/dmmes into dev 2023-09-11 11:21:08 +08:00
hongwenwu 13a3da9b4e 加工单撤回 2023-09-11 11:21:02 +08:00
ykxiao 06a645973e 增加请求参数日志 2023-09-09 15:36:29 +08:00
ykxiao 9b3913ed60 更新文档 2023-09-09 15:01:31 +08:00
2 changed files with 43 additions and 15 deletions

View File

@ -26,13 +26,13 @@ $secretKey = 'gFBfirGATxafTeq74RAngaL74Ksdxhuy';
$options = [ $options = [
'logger' => true, '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); $w = new Order($secretKey, 'callback url', $options);
// 获取工单数据 // 获取工单数据
$response = $w->getProductOrder('SN5436745676543'); $response = $w->getProductOrder(1);
// 加工工单原木材种 // 加工工单原木材种
$w->getWoodTypeOptions([ $w->getWoodTypeOptions([
@ -57,6 +57,17 @@ $response = $w->createProductOrder([
'number_pcs' => 10, 'number_pcs' => 10,
'owner' => 'ykxiao' 'owner' => 'ykxiao'
]); ]);
// 更新加工工单
$response = $w->updateProductOrder([
'id' => 1,
'company_id' => 1,
]);
// 撤回加工工单
$response = $w->revokeProductOrder([
'id' => 1
]);
``` ```
# 回调说明 # 回调说明

View File

@ -124,10 +124,10 @@ class Order
$result = 'json' === self::DEFAULT_FORMAT ? json_decode($response, true) : $response; $result = 'json' === self::DEFAULT_FORMAT ? json_decode($response, true) : $response;
// 日志 // 日志
$this->logger(['response' => $result]); $this->logger(['request' => $body, 'response' => $result]);
return $result; return $result;
} catch (\Exception $e) { } catch (\Exception $e) {
$this->logger(['response' => $e]); $this->logger(['request' => $body, 'response' => $e]);
throw new HttpException($e->getMessage(), $e->getCode(), $e); throw new HttpException($e->getMessage(), $e->getCode(), $e);
} }
} }
@ -136,46 +136,63 @@ class Order
* 获取工单信息 * 获取工单信息
* @param $order_sn * @param $order_sn
* @return mixed|string * @return mixed|string
* @throws \Exception|GuzzleException * @throws GuzzleException
*/ */
public function getProductOrder($order_sn) public function getProductOrder($orderId)
{ {
$data = [ $data = [
'order_sn' => $order_sn 'id' => $orderId
]; ];
return $this->sendRequest('production.status', $data); return $this->sendRequest('production.info', $data);
} }
/** /**
* 加工工单原木材种 * 加工工单原木材种
* @return mixed|string * @return mixed|string
* @throws GuzzleException * @throws GuzzleException
* @throws HttpException
* @throws InvalidArgumentException
*/ */
public function getWoodTypeOptions($data) public function getWoodTypeOptions($data)
{ {
return $this->baseFun($data, 'Wood.types'); return $this->sendRequest('Wood.types', $data);
} }
/** /**
* 加工等级 * 加工等级
* @return mixed|string * @return mixed|string
* @throws GuzzleException * @throws GuzzleException
* @throws HttpException
* @throws InvalidArgumentException
*/ */
public function getProductionLevelOptions($data) public function getProductionLevelOptions($data)
{ {
return $this->baseFun($data, 'production.levels'); return $this->sendRequest('production.levels', $data);
} }
/** /**
* 加工工单创建 * 加工工单创建
* @return mixed|string * @return mixed|string
* @throws \Exception|GuzzleException * @throws GuzzleException
*/ */
public function createProductOrder($data) public function createProductOrder($data)
{ {
return $this->sendRequest('production.create', $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);
}
} }