Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CnChunfeng
/
scm_wms_outstore_service
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
f64e9a4a
authored
May 16, 2020
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
完善添加
parent
3ce6bf13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
257 additions
and
39 deletions
app/Http/Controllers/AdminOutstoreController.php
app/Http/Model/Logic/CommonLogic.php
app/Http/Model/Logic/OutStoreLogic.php
app/Http/Model/Logic/PalletLogic.php
app/Http/Model/Logic/PickTaskLogic.php
app/Http/Controllers/AdminOutstoreController.php
View file @
f64e9a4a
...
...
@@ -170,12 +170,11 @@ class AdminOutstoreController extends Controller
public
function
palletActive
(
$request
)
{
$data
=
$request
->
all
();
// try{
// $returnData = (new PalletLogic())->palletActive($data);
// }catch (\Exception $exception){
// return $this->apiReturn($exception->getMessage().'|jsondata='.json_encode($data));
// }
$returnData
=
(
new
PalletLogic
())
->
palletActive
(
$data
);
try
{
$returnData
=
(
new
PalletLogic
())
->
palletActive
(
$data
);
}
catch
(
\Exception
$exception
){
return
$this
->
apiReturn
(
$exception
->
getMessage
()
.
'|jsondata='
.
json_encode
(
$data
));
}
return
$this
->
apiReturn
(
$returnData
);
}
...
...
@@ -207,6 +206,47 @@ class AdminOutstoreController extends Controller
return
$this
->
apiReturn
(
$returnData
);
}
//获取卡板标签打印信息
public
function
print_pallet_label
(
$request
)
{
$data
=
$request
->
all
();
try
{
$returnData
=
(
new
PalletLogic
())
->
print_pallet_label
(
$data
);
}
catch
(
\Exception
$exception
){
if
(
empty
(
self
::
$errCode
))
self
::
$errCode
=
101
;
return
$this
->
apiReturn
(
$exception
->
getMessage
());
}
return
$this
->
apiReturn
(
$returnData
);
}
//获取卡板标签打印信息
public
function
print_box_label
(
$request
)
{
$data
=
$request
->
all
();
try
{
$returnData
=
(
new
PalletLogic
())
->
print_box_label
(
$data
);
}
catch
(
\Exception
$exception
){
if
(
empty
(
self
::
$errCode
))
self
::
$errCode
=
101
;
return
$this
->
apiReturn
(
$exception
->
getMessage
());
}
return
$this
->
apiReturn
(
$returnData
);
}
//获取卡板标签打印信息
public
function
print_pick_task_label
(
$request
)
{
$data
=
$request
->
all
();
try
{
$returnData
=
(
new
PalletLogic
())
->
print_pick_task_label
(
$data
);
}
catch
(
\Exception
$exception
){
if
(
empty
(
self
::
$errCode
))
self
::
$errCode
=
101
;
return
$this
->
apiReturn
(
$exception
->
getMessage
());
}
return
$this
->
apiReturn
(
$returnData
);
}
//获取拣货任务打印信息
public
function
print_pick_task_info
(
$request
)
{
...
...
app/Http/Model/Logic/CommonLogic.php
View file @
f64e9a4a
...
...
@@ -59,7 +59,6 @@ class CommonLogic
case
'delivery_id'
://
发货人员
case
'admin_id'
://
根据id获取人员姓名
case
'pick_user_id'
://
拣货人
case
'confirm_user_id'
://
确认人
$value
=
'暂未录入'
;
break
;
case
'store_id'
://
根据仓库IDid获取名称
$value
=
StoreModel
::
where
(
'store_id'
,
$value
)
->
value
(
"store_name"
);
break
;
...
...
@@ -113,7 +112,7 @@ class CommonLogic
{
$outStoreArr
=
OutStoreDetailModel
::
whereIn
(
'out_store_detail_id'
,
$outStoreDetailIdArr
)
->
pluck
(
'out_store_id'
)
->
toArray
();
foreach
(
array_
filter
(
$outStoreArr
)
as
$key
=>
$value
){
foreach
(
array_
unique
(
array_filter
(
$outStoreArr
)
)
as
$key
=>
$value
){
$outStoreInfo
=
OutStoreModel
::
getWhereObj
([])
->
where
(
'out_store_id'
,
$value
)
->
first
();
...
...
@@ -127,8 +126,8 @@ class CommonLogic
'SyncName'
=>
'out_store'
,
'Data'
=>
[
'erp_store_id'
=>
$outStoreInfo
->
erp_out_store_id
,
'box_number'
=>
count
(
array_
filter
(
array_column
(
$outStoreDetailData
,
'box_id'
))),
'pallet_number'
=>
count
(
array_
filter
(
array_column
(
$outStoreDetailData
,
'pallet_id'
))),
'box_number'
=>
count
(
array_
unique
(
array_filter
(
array_column
(
$outStoreDetailData
,
'box_id'
)
))),
'pallet_number'
=>
count
(
array_
unique
(
array_filter
(
array_column
(
$outStoreDetailData
,
'pallet_id'
)
))),
'detail'
=>
$outStoreDetailData
,
]
];
...
...
app/Http/Model/Logic/OutStoreLogic.php
View file @
f64e9a4a
...
...
@@ -177,10 +177,10 @@ class OutStoreLogic
$outStoreDetailId
=
OutStoreDetailModel
::
insertGetId
(
array_merge
(
self
::
handleOutStoreDetailInsertData
(
$value
,
$insertData
),[
'pick_task_id'
=>
$pickTaskId
]));
//is_apply_customs报关任务默认隐藏
PickTaskDetailModel
::
insertGetId
(
PickTaskLogic
::
handleInsertData
(
[
PickTaskDetailModel
::
insertGetId
([
'out_store_id'
=>
$outStoreId
,
'out_store_detail_id'
=>
$outStoreDetailId
,
'store_id'
=>
$insertData
[
'store_id'
],
'pick_task_id'
=>
$pickTaskId
,
'is_show'
=>
empty
(
$insertData
[
'is_apply_customs'
])
?
1
:
0
])
)
;
]);
}
DB
::
commit
();
...
...
app/Http/Model/Logic/PalletLogic.php
View file @
f64e9a4a
This diff is collapsed.
Click to expand it.
app/Http/Model/Logic/PickTaskLogic.php
View file @
f64e9a4a
...
...
@@ -41,15 +41,41 @@ class PickTaskLogic
}
//拣货任务逻辑层
static
public
function
handleInsertData
(
$data
)
//拣货任务
生成
逻辑层
static
public
function
handleInsertData
(
$data
,
$outStoreDetail
)
{
//判断该拣货任务是否存在
if
(
!
empty
(
PickTaskDetailModel
::
where
(
'out_store_detail_id'
,
$data
[
'out_store_detail_id'
])
->
value
(
'pick_task_detail_id'
))){
throw
new
\Exception
(
'该出库商品拣货任务已经存在'
);
}
$data
[
'add_time'
]
=
time
();
return
$data
;
$pickData
=
[];
//查询当前商品所绑定的库存
$stockInfo
=
StockModel
::
where
(
'goods_id'
,
$outStoreDetail
[
'goods_id'
])
->
where
(
'warehousing_sn'
,
$outStoreDetail
[
'warehousing_sn'
])
->
orderBy
(
'stock'
,
'asc'
)
->
get
();
if
(
empty
(
$stockInfo
)){
throw
new
\Exception
(
'当前入库单的商品库存不存在'
);
}
$stockInfo
=
$stockInfo
->
toArray
();
//根据货位,卡板
foreach
(
$stockInfo
as
$stockValue
){
$locationkey
=
$stockValue
[
'location_id'
]
.
'_'
.
$stockValue
[
'pallet_id'
]
.
'_'
.
$stockValue
[
'box_id'
];
if
(
isset
(
$pickData
[
$locationkey
])){
$pickData
[
$locationkey
]
=
bcadd
(
$stockValue
[
'stock'
],
$pickData
[
$locationkey
]);
}
else
{
$pickData
[
$locationkey
]
=
$stockValue
[
'stock'
];
}
}
//生成拣货记录
foreach
(
$pickData
as
$key
=>
$value
){
$locatiion
=
explode
(
'_'
,
$key
);
$data
[
'number'
]
=
$value
;
$data
[
'location_id'
]
=
$locatiion
[
0
];
$data
[
'pallet_id'
]
=
$locatiion
[
1
];
$data
[
'box_id'
]
=
$locatiion
[
2
];
$returData
[]
=
array_merge
(
$value
,
$data
);
}
return
$returData
;
}
//生成拣货任务
...
...
@@ -98,7 +124,17 @@ class PickTaskLogic
$outStoreDetailIdArr
=
OutStoreDetailModel
::
where
(
'pick_task_id'
,
$pickTaskId
)
->
where
(
'location_id'
,
$locationId
)
->
pluck
(
'out_store_detail_id'
);
}
$returnData
=
PickTaskDetailModel
::
where
(
'is_del'
,
0
)
->
where
(
'is_show'
,
1
)
->
orderBy
(
'pick_status'
,
'asc'
)
->
whereIn
(
'out_store_detail_id'
,
$outStoreDetailIdArr
)
->
orderBy
(
'add_time'
,
'desc'
)
->
get
();
$returnData
=
PickTaskDetailModel
::
where
(
'is_del'
,
0
)
->
where
(
'is_show'
,
1
)
->
orderBy
(
'pick_status'
,
'asc'
)
->
orderBy
(
'add_time'
,
'desc'
)
->
where
(
'pick_task_id'
,
$pickTaskId
);
if
(
!
empty
(
$outStoreDetailIdArr
)){
$returnData
=
$returnData
->
whereIn
(
'out_store_detail_id'
,
$outStoreDetailIdArr
);
}
$returnData
=
$returnData
->
get
();
if
(
empty
(
$returnData
)){
return
[];
...
...
@@ -109,7 +145,7 @@ class PickTaskLogic
foreach
(
$returnData
as
$key
=>
$value
){
$value
=
array_merge
(
$value
,
OutStoreDetailModel
::
where
(
'out_store_detail_id'
,
$value
[
'out_store_detail_id'
])
->
first
()
->
toArray
());
$returnData
[
$key
]
=
CommonLogic
::
getHaveKeyCn
(
$value
);
$returnData
[
$key
][
'piece_num'
]
=
0
;
$returnData
[
$key
][
'piece_num'
]
=
1
;
}
return
$returnData
;
}
...
...
@@ -129,6 +165,7 @@ class PickTaskLogic
DB
::
beginTransaction
();
try
{
foreach
(
$pickTaskDetail
as
$value
){
...
...
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