Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CnChunfeng
/
scm_wms_outstore_api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5b65c4c2
authored
Apr 29, 2020
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加出库接口
parent
e1d1512a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
169 additions
and
10 deletions
app/Http/Controllers/Controller.php
app/Http/Controllers/InStoreController.php
app/Http/Controllers/OutStoreController.php
app/Http/Logic/CommonLogic.php
app/Http/routes.php
config/website.php
app/Http/Controllers/Controller.php
View file @
5b65c4c2
...
...
@@ -2,11 +2,26 @@
namespace
App\Http\Controllers
;
use
App\Http\Logic\CommonLogic
;
use
Laravel\Lumen\Routing\Controller
as
BaseController
;
class
Controller
extends
BaseController
{
public
function
apiReturn
(
$errcode
=
0
,
$errmsg
=
'OK'
,
$dataArr
=
[]){
public
function
returnJson
(
$data
)
{
if
(
is_array
(
$data
)){
return
$this
->
apiReturn
(
0
,
'OK'
,
$data
);
}
//设置默认错误code
if
(
empty
(
CommonLogic
::
$errCode
)){
CommonLogic
::
$errCode
=
1
;
}
return
$this
->
apiReturn
(
CommonLogic
::
$errCode
,
$data
,[]);
}
public
function
apiReturn
(
$errcode
=
0
,
$errmsg
=
'OK'
,
$dataArr
=
[])
{
$response
=
[
'errcode'
=>
$errcode
,
'errmsg'
=>
$errmsg
,
...
...
@@ -15,15 +30,15 @@ class Controller extends BaseController
return
response
()
->
json
(
$response
);
}
public
function
curl
(
$Url
,
$data
,
$request
,
&
$response
=
''
){
$Domain
=
config
(
'website.IN_STORE_SERVICE_URL'
);
public
function
curl
(
$Url
,
$data
,
$request
,
&
$response
=
''
)
{
$Domain
=
config
(
'website.OUT_STORE_SERVICE_URL'
);
$warehousing_url
=
$Domain
.
$Url
;
$data
[
'admin_id'
]
=
$request
->
user
->
userId
;
$data
[
'admin_name'
]
=
$request
->
user
->
name
;
$data
[
'store_id'
]
=
$request
->
store_id
;
// $data['admin_id'] = $request->user->userId;
// $data['admin_name'] = $request->user->name;
// $data['store_id'] = $request->store_id;
$response
=
curl
(
$warehousing_url
,
$data
,
true
);
return
json_decode
(
$response
,
true
);
return
json_decode
(
$response
,
true
);
}
}
app/Http/Controllers/InStoreController.php
View file @
5b65c4c2
...
...
@@ -2,7 +2,6 @@
namespace
App\Http\Controllers
;
use
App\Model\CountryModel
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Validator
;
...
...
app/Http/Controllers/OutStoreController.php
0 → 100644
View file @
5b65c4c2
<?php
/**
* Created by 2020/4/28.
* User: Joneq
* Info: 2020/4/28
* Time: 上午11:31
*/
namespace
App\Http\Controllers
;
use
App\Http\Logic\CommonLogic
;
use
Illuminate\Http\Request
;
class
OutStoreController
extends
Controller
{
public
function
Entrance
(
Request
$request
,
$id
)
{
CommonLogic
::
$errCode
=
0
;
return
$this
->
$id
(
$request
,
$id
);
}
//获取拣货列表
public
function
pick_task_list
(
$request
)
{
$data
=
$request
->
all
();
try
{
CommonLogic
::
checkEmpty
([
'location_id'
,
'pick_task_sn'
],
$data
);
$returnData
=
$this
->
curl
(
'/pick_task/getFrontPickTaskList'
,
$data
,
$request
);
if
(
!
isset
(
$returnData
[
'errcode'
])
&&
!
empty
(
$returnData
[
'errcode'
])){
CommonLogic
::
$errCode
=
$returnData
[
'errcode'
];
throw
new
\Exception
(
$returnData
[
'data'
]);
}
}
catch
(
\Exception
$exception
){
return
$this
->
returnJson
(
$exception
->
getMessage
());
}
return
$this
->
returnJson
(
$returnData
[
'data'
]);
}
//拣货确认
public
function
confirm_pick
(
$request
)
{
$data
=
$request
->
all
();
try
{
CommonLogic
::
checkEmpty
([
'location_id'
,
'pick_task_sn'
,
'goods_sn'
],
$data
);
$returnData
=
$this
->
curl
(
'/pick_task/confirmPick'
,
$data
,
$request
);
if
(
!
isset
(
$returnData
[
'errcode'
])
&&
!
empty
(
$returnData
[
'errcode'
])){
CommonLogic
::
$errCode
=
$returnData
[
'errcode'
];
throw
new
\Exception
(
$returnData
[
'data'
]);
}
}
catch
(
\Exception
$exception
){
return
$this
->
returnJson
(
$exception
->
getMessage
());
}
return
$this
->
returnJson
(
$returnData
[
'data'
]);
}
//获取卡板信息
public
function
pallet_box_list
(
$request
)
{
$data
=
$request
->
all
();
try
{
CommonLogic
::
checkEmpty
([
'pallet_id'
],
$data
);
$returnData
=
$this
->
curl
(
'/out_store/palletBoxList'
,
$data
,
$request
);
if
(
!
isset
(
$returnData
[
'errcode'
])
&&
!
empty
(
$returnData
[
'errcode'
])){
CommonLogic
::
$errCode
=
$returnData
[
'errcode'
];
throw
new
\Exception
(
$returnData
[
'data'
]);
}
}
catch
(
\Exception
$exception
){
return
$this
->
returnJson
(
$exception
->
getMessage
());
}
return
$this
->
returnJson
(
$returnData
[
'data'
]);
}
//装卡板
public
function
pallet_active
(
$request
)
{
$data
=
$request
->
all
();
try
{
CommonLogic
::
checkEmpty
([
'box_id_arr'
,
'pallet_sn'
],
$data
);
$returnData
=
$this
->
curl
(
'/out_store/palletActive'
,
$data
,
$request
);
if
(
isset
(
$returnData
[
'errcode'
])
&&
!
empty
(
$returnData
[
'errcode'
])){
CommonLogic
::
$errCode
=
$returnData
[
'errcode'
];
throw
new
\Exception
(
$returnData
[
'data'
]);
}
}
catch
(
\Exception
$exception
){
return
$this
->
returnJson
(
$exception
->
getMessage
());
}
return
$this
->
returnJson
(
$returnData
[
'data'
]);
}
//扫描出库
public
function
scan_out_store
(
$request
)
{
}
}
\ No newline at end of file
app/Http/Logic/CommonLogic.php
0 → 100644
View file @
5b65c4c2
<?php
/**
* Created by 2020/4/28.
* User: Joneq
* Info: 2020/4/28
* Time: 下午4:17
*/
namespace
App\Http\Logic
;
class
CommonLogic
{
static
public
$errCode
=
0
;
//检测值是否为空
static
public
function
checkEmpty
(
$key
,
$data
)
{
foreach
(
$key
as
$value
){
if
(
!
isset
(
$data
[
$value
])
||
is_null
(
$data
[
$value
])){
self
::
$errCode
=
1
;
throw
new
\Exception
(
$value
.
' is null'
);
}
}
}
}
\ No newline at end of file
app/Http/routes.php
View file @
5b65c4c2
...
...
@@ -25,3 +25,4 @@ $app->get('/',function ()use($app){
});
$app
->
get
(
'/test/index'
,
'ExampleController@index'
);
$app
->
post
(
'/in_store/{key}'
,
'InStoreController@Entrance'
);
$app
->
post
(
'/out_store/{key}'
,
'OutStoreController@Entrance'
);
config/website.php
View file @
5b65c4c2
...
...
@@ -2,6 +2,6 @@
return
[
'verification_token'
=>
'http://'
.
env
(
'LOGIN_DOMAIN'
,
''
)
.
'/pwd/me'
,
'
IN_STORE_SERVICE_URL'
=>
env
(
'IN
_STORE_SERVICE_URL'
)
'
OUT_STORE_SERVICE_URL'
=>
env
(
'OUT
_STORE_SERVICE_URL'
)
];
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment