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
04b5a429
authored
May 17, 2020
by
Joneq
Browse files
Options
_('Browse Files')
Download
Plain Diff
修改代码
parents
97959587
80cb8e95
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
175 additions
and
25 deletions
app/Http/Controllers/AdminOutstoreController.php
app/Http/Controllers/PicktaskController.php
app/Http/Model/Logic/OutStoreLogic.php
app/Http/Model/Logic/PickTaskLogic.php
storage/laravels.json
storage/laravels.pid
app/Http/Controllers/AdminOutstoreController.php
View file @
04b5a429
...
...
@@ -12,6 +12,7 @@ use App\Http\Model\Logic\PackCheckLogic;
use
App\Http\Model\Logic\PalletLogic
;
use
App\Http\Model\Logic\PickTaskLogic
;
use
App\Http\Model\OutStoreDetailModel
;
use
App\Http\Model\PickTaskDetailModel
;
use
Illuminate\Http\Request
;
class
AdminOutstoreController
extends
Controller
...
...
@@ -44,11 +45,17 @@ class AdminOutstoreController extends Controller
$data
=
$request
->
all
();
try
{
<<<<<<<
HEAD
//获取需要修改的货品121
if
(
$data
[
'out_store_detail_id'
]
==
'all'
){
$data
[
'out_store_detail_id_arr'
]
=
OutStoreDetailModel
::
where
(
'out_store_id'
,
$data
[
'out_store_id'
])
->
pluck
(
'out_store_detail_id'
);
=======
//获取需要修改的货品
if
(
$data
[
'pick_task_detail_id'
]
==
'all'
){
$data
[
'pick_task_detail_id_arr'
]
=
PickTaskDetailModel
::
where
(
'out_store_id'
,
$data
[
'out_store_id'
])
->
whereIn
(
'pick_status'
,[
1
,
4
])
->
pluck
(
'pick_task_detail_id'
);
>>>>>>>
develop
}
else
{
$data
[
'
out_store_detail_id_arr'
]
=
[
$data
[
'out_store
_detail_id'
]];
$data
[
'
pick_task_detail_id_arr'
]
=
[
$data
[
'pick_task
_detail_id'
]];
}
$returnData
=
(
new
PickTaskLogic
())
->
confirmPick
(
$data
);
}
catch
(
\Exception
$exception
){
...
...
@@ -64,10 +71,10 @@ class AdminOutstoreController extends Controller
$data
=
$request
->
all
();
try
{
//获取需要修改的货品
if
(
$data
[
'
out_store
_detail_id'
]
==
'all'
){
$data
[
'
out_store_detail_id_arr'
]
=
OutStoreDetailModel
::
where
(
'out_store_id'
,
$data
[
'out_store_id'
])
->
pluck
(
'out_store_detail_id'
);
if
(
$data
[
'
pick_task
_detail_id'
]
==
'all'
){
$data
[
'
pick_task_detail_id_arr'
]
=
PickTaskDetailModel
::
where
(
'out_store_id'
,
$data
[
'out_store_id'
])
->
pluck
(
'pick_task_detail_id'
)
->
toArray
(
);
}
else
{
$data
[
'
out_store_detail_id_arr'
]
=
[
$data
[
'out_store
_detail_id'
]];
$data
[
'
pick_task_detail_id_arr'
]
=
[
$data
[
'pick_task
_detail_id'
]];
}
$returnData
=
(
new
PickTaskLogic
())
->
cancelPick
(
$data
);
}
catch
(
\Exception
$exception
){
...
...
app/Http/Controllers/PicktaskController.php
View file @
04b5a429
...
...
@@ -84,8 +84,8 @@ class PicktaskController extends Controller
if
(
empty
(
$outStoreDetailIdArr
)){
throw
new
\Exception
(
'该任务下没有这个型号'
);
}
$
data
[
'out_store_detail_id_arr'
]
=
$outStoreDetailIdArr
;
$returnData
=
(
new
PickTaskLogic
())
->
confirmPick
(
$data
);
$
pickTaskDetailArr
=
PickTaskDetailModel
::
getWhereObj
([])
->
whereIn
(
'out_store_detail_id'
,
$outStoreDetailIdArr
)
->
whereIn
(
'pick_status'
,[
1
,
4
])
->
pluck
(
'pick_task_detail_id'
)
->
toArray
()
;
$returnData
=
(
new
PickTaskLogic
())
->
confirmPick
(
[
'pick_task_detail_id_arr'
=>
$pickTaskDetailArr
]
);
}
catch
(
\Exception
$exception
){
if
(
empty
(
self
::
$errCode
))
self
::
$errCode
=
101
;
return
$this
->
apiReturn
(
$exception
->
getMessage
());
...
...
@@ -101,12 +101,14 @@ class PicktaskController extends Controller
try
{
//获取所有的out_store_detail_id
$
outStoreDetailIdArr
=
PickTaskDetailModel
::
where
(
'pick_task_detail_id'
,
$data
[
'pick_task_detail_id'
])
->
pluck
(
'out_store
_detail_id'
);
$
pickTaskDetailIdArr
=
PickTaskDetailModel
::
where
(
'pick_task_detail_id'
,
$data
[
'pick_task_detail_id'
])
->
where
(
'pick_status'
,
3
)
->
pluck
(
'pick_task
_detail_id'
);
if
(
empty
(
$
outStore
DetailIdArr
)){
if
(
empty
(
$
pickTask
DetailIdArr
)){
throw
new
\Exception
(
'该任务下没有这个型号'
);
}
$data
[
'out_store_detail_id_arr'
]
=
$outStoreDetailIdArr
;
$pickTaskDetailIdArr
=
$pickTaskDetailIdArr
->
toArray
();
$data
[
'pick_task_detail_id_arr'
]
=
$pickTaskDetailIdArr
;
$returnData
=
(
new
PickTaskLogic
())
->
cancelPick
(
$data
);
}
catch
(
\Exception
$exception
){
...
...
app/Http/Model/Logic/OutStoreLogic.php
View file @
04b5a429
...
...
@@ -55,7 +55,7 @@ class OutStoreLogic
//判断该入库单号是否拥有
if
(
!
empty
(
OutStoreModel
::
where
(
'warehousing_sn'
,
$data
[
'warehousing_sn'
])
->
value
(
'out_store_id'
))){
Controller
::
$level
=
5
;
Controller
::
$errCode
=
2
;
throw
new
\Exception
(
'该入
库
单号已经存在'
.
$data
[
'warehousing_sn'
]);
throw
new
\Exception
(
'该入
仓
单号已经存在'
.
$data
[
'warehousing_sn'
]);
}
//判断入库详情是否为空
...
...
@@ -174,13 +174,18 @@ class OutStoreLogic
OutStoreModel
::
where
(
'out_store_id'
,
$outStoreId
)
->
update
([
'is_insp'
=>
1
]);
}
$outStoreDetailId
=
OutStoreDetailModel
::
insertGetId
(
array_merge
(
self
::
handleOutStoreDetailInsertData
(
$value
,
$insertData
),[
'pick_task_id'
=>
$pickTaskId
]));
$value
=
array_merge
(
self
::
handleOutStoreDetailInsertData
(
$value
,
$insertData
),[
'pick_task_id'
=>
$pickTaskId
]);
$outStoreDetailId
=
OutStoreDetailModel
::
insertGetId
(
$value
);
//is_apply_customs报关任务默认隐藏
PickTaskDetailModel
::
insertGetId
(
PickTaskLogic
::
handleInsertData
([
$pickTaskData
=
PickTaskLogic
::
handleInsertData
([
'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
]));
],
$value
);
foreach
(
$pickTaskData
as
$v
){
PickTaskDetailModel
::
insertGetId
(
$v
);
}
}
DB
::
commit
();
...
...
app/Http/Model/Logic/PickTaskLogic.php
View file @
04b5a429
...
...
@@ -94,7 +94,7 @@ class PickTaskLogic
$data
[
'pick_remark'
]
=
'拆零'
;
}
}
$returData
[]
=
array_merge
(
$value
,
$data
)
;
$returData
[]
=
$data
;
}
if
(
empty
(
$isAllGoods
)){
...
...
@@ -185,6 +185,143 @@ class PickTaskLogic
public
function
confirmPick
(
$data
)
{
$pickTaskDetailIdArr
=
$data
[
'pick_task_detail_id_arr'
];
//获取可以拣货的数据
if
(
empty
(
$pickTaskDetail
=
PickTaskDetailModel
::
whereIn
(
'pick_task_detail_id'
,
$pickTaskDetailIdArr
)
->
where
(
'pick_status'
,
'!='
,
3
)
->
get
())){
throw
new
\Exception
(
'当前出库号没有可以拣货任务: '
);
}
$pickTaskDetail
=
$pickTaskDetail
->
toArray
();
self
::
checkIsPackCheck
(
$pickTaskDetailIdArr
,
'该单据已经复核,不可再拣货'
);
DB
::
beginTransaction
();
try
{
foreach
(
$pickTaskDetail
as
$value
){
//获取需要配合的拣货详情
if
(
empty
(
$outStoreDetailInfo
=
OutStoreDetailModel
::
where
(
'out_store_detail_id'
,
$value
[
'out_store_detail_id'
])
->
first
())){
throw
new
\Exception
(
'当前出库详情没有数据: '
.
$value
[
'out_store_detail_id'
]);
}
if
(
empty
(
$outStoreInfo
=
OutStoreModel
::
where
(
'out_store_id'
,
$value
[
'out_store_id'
])
->
first
())){
throw
new
\Exception
(
'当前出库单没有数据: '
.
$value
[
'out_store_id'
]);
}
$outStoreInfo
=
$outStoreInfo
->
toArray
();
$outStoreDetailInfo
=
$outStoreDetailInfo
->
toArray
();
//增加冻结库存,扣减可用库存,实际库存不变 如果为散件,则生成打包复核任务
if
(
empty
(
$stockInfo
=
StockModel
::
where
(
'warehousing_sn'
,
$outStoreDetailInfo
[
'warehousing_sn'
])
->
where
(
'location_id'
,
$value
[
'location_id'
])
->
where
(
'pallet_id'
,
$value
[
'pallet_id'
])
->
where
(
'box_id'
,
$value
[
'box_id'
])
->
where
(
'goods_id'
,
$outStoreDetailInfo
[
'goods_id'
])
->
get
())){
throw
new
\Exception
(
'当前库存详情没有数据: '
.
$value
[
'pick_task_detail_id'
]);
}
$stockInfo
=
$stockInfo
->
toArray
();
//下架箱子和卡板
if
(
!
empty
(
$value
[
'box_id'
])){
BoxModel
::
getWhereObj
([])
->
where
(
'box_id'
,
$value
[
'box_id'
])
->
update
([
'status'
=>
3
]);
}
if
(
!
empty
(
$value
[
'pallet_id'
])){
PalletModel
::
getWhereObj
([])
->
where
(
'pallet_id'
,
$value
[
'pallet_id'
])
->
update
([
'status'
=>
3
]);
}
//如果该任务没有打包复核任务,而且还是散件,就生成一个打包复核任务
if
(
$outStoreInfo
[
'remark'
]
==
'散件'
){
$picktaskInfo
=
PickTaskModel
::
getWhereObj
([])
->
where
(
'pick_task_id'
,
$value
[
'pick_task_id'
])
->
first
();
if
(
!
empty
(
$picktaskInfo
)){
//如果没有就添加
if
(
empty
(
$packInfo
=
PackCheckModel
::
getWhereObj
([])
->
where
(
'pick_task_id'
,
$value
[
'pick_task_id'
])
->
first
())){
$packCheckId
=
PackCheckModel
::
insertGetId
([
'pack_check_sn'
=>
PackCheckLogic
::
getPackCheckSn
(),
'pick_task_sn'
=>
$picktaskInfo
[
'pick_task_sn'
],
'in_store_sn'
=>
$outStoreInfo
[
'warehousing_sn'
],
'pick_task_id'
=>
$picktaskInfo
[
'pick_task_id'
],
'add_time'
=>
time
(),
'store_id'
=>
CommonLogic
::
getAdminInfo
()[
'store_id'
]
]);
}
else
{
$packCheckId
=
$packInfo
->
pack_check_id
;
}
PickTaskDetailModel
::
getWhereObj
([])
->
where
(
'pick_task_detail_id'
,
$value
[
'pick_task_detail_id'
])
->
update
([
'pack_check_id'
=>
$packCheckId
]);
}
}
//查看数量是否足够 ,所有库存减去冻结库存
$totalNumber
=
array_sum
(
array_column
(
$stockInfo
,
'stock'
));
$totalNumber
=
$totalNumber
-
StockFrozenModel
::
where
(
'goods_id'
,
$outStoreDetailInfo
[
'goods_id'
])
->
where
(
'pick_task_detail_id'
,
$value
[
'pick_task_detail_id'
])
->
where
(
'status'
,
1
)
->
sum
(
'number'
);
if
(
$totalNumber
<
$value
[
'number'
]){
throw
new
\Exception
(
'该商品库存不足'
);
}
$needNumber
=
$value
[
'number'
];
foreach
(
$stockInfo
as
$stockKey
=>
$stockValue
){
//所需要库存完整了,就停止
if
(
$needNumber
<=
0
){
break
;
}
//查看当前可用的库存是否充足,没有了直接跳过
if
(
$currentStocFrozenkNum
=
StockFrozenModel
::
whereIn
(
'stock_id'
,[
$stockValue
[
'stock_id'
]])
->
where
(
'pick_task_detail_id'
,
$value
[
'pick_task_detail_id'
])
->
where
(
'status'
,
1
)
->
value
(
'number'
)){
if
(
(
$stockValue
[
'stock'
]
-=
$currentStocFrozenkNum
)
<=
0
){
continue
;
}
}
//增加相应的冻结库存
if
(
$stockValue
[
'stock'
]
<
$needNumber
){
$needNumber
=
bcsub
(
$needNumber
,
$stockValue
[
'stock'
]);
$stockFrozenNum
=
$stockValue
[
'stock'
];
}
else
{
$stockFrozenNum
=
$needNumber
;
$needNumber
=
0
;
}
//增加冻结库存
if
(
$frozenInfo
=
StockFrozenModel
::
where
(
'stock_id'
,
$stockValue
[
'stock_id'
])
->
where
(
'pick_task_detail_id'
,
$value
[
'pick_task_detail_id'
])
->
first
()){
$frozenInfo
=
$frozenInfo
->
toArray
();
StockFrozenModel
::
where
(
'stock_id'
,
$stockValue
[
'stock_id'
])
->
where
(
'pick_task_detail_id'
,
$value
[
'pick_task_detail_id'
])
->
update
([
'number'
=>
bcadd
(
$frozenInfo
[
'number'
],
$stockFrozenNum
)]);
}
else
{
StockFrozenModel
::
insertGetId
([
'stock_id'
=>
$stockValue
[
'stock_id'
],
'store_id'
=>
$outStoreInfo
[
'store_id'
],
'location_id'
=>
$value
[
'location_id'
],
'goods_id'
=>
$outStoreDetailInfo
[
'goods_id'
],
'status'
=>
1
,
'add_time'
=>
time
(),
'number'
=>
$stockFrozenNum
,
'pick_task_detail_id'
=>
$value
[
'pick_task_detail_id'
]
]);
}
}
}
//确认拣货
PickTaskDetailModel
::
where
(
'pick_task_detail_id'
,
$pickTaskDetailIdArr
)
->
update
([
'pick_status'
=>
3
,
'pick_time'
=>
time
(),
'pick_user_name'
=>
CommonLogic
::
getAdminInfo
()[
'admin_name'
]]);
DB
::
commit
();
}
catch
(
\Exception
$exception
){
DB
::
rollBack
();
throw
new
\Exception
(
'拣货事物异常错误为: '
.
$exception
->
getMessage
());
}
return
[];
}
//拣货
public
function
confirmPick_back
(
$data
)
{
$outStoreDetailIdArr
=
$data
[
'out_store_detail_id_arr'
];
//获取可以拣货的数据
...
...
@@ -313,24 +450,20 @@ class PickTaskLogic
*/
public
function
cancelPick
(
$data
)
{
$
outStoreDetailIdArr
=
$data
[
'out_store
_detail_id_arr'
];
$
pickTaskDetailIdArr
=
$data
[
'pick_task
_detail_id_arr'
];
//获取可以拣货的数据
if
(
empty
(
$pickTaskDetail
=
PickTaskDetailModel
::
whereIn
(
'
out_store_detail_id'
,
$outStore
DetailIdArr
)
->
where
(
'pick_status'
,
'='
,
3
)
->
get
()
->
toArray
())){
if
(
empty
(
$pickTaskDetail
=
PickTaskDetailModel
::
whereIn
(
'
pick_task_detail_id'
,
$pickTask
DetailIdArr
)
->
where
(
'pick_status'
,
'='
,
3
)
->
get
()
->
toArray
())){
throw
new
\Exception
(
'当前出库号没有可以取消的拣货任务: '
);
}
self
::
checkIsPackCheck
(
$outStoreDetailIdArr
,
'该单据已经复核,不可再取消拣货'
);
DB
::
beginTransaction
();
try
{
foreach
(
$pickTaskDetail
as
$value
){
//获取需要配合的拣货详情
if
(
empty
(
$outStoreDetailInfo
=
OutStoreDetailModel
::
where
(
'out_store_detail_id'
,
$value
[
'out_store_detail_id'
])
->
first
())){
throw
new
\Exception
(
'当前出库详情没有数据: '
.
$value
[
'out_store_detail_id'
]);
...
...
@@ -345,7 +478,7 @@ class PickTaskLogic
StockFrozenModel
::
where
(
'pick_task_detail_id'
,
$value
[
'pick_task_detail_id'
])
->
update
([
'number'
=>
0
]);
//取消拣货
PickTaskDetailModel
::
where
(
'pick_task_detail_id'
,
$
outStore
DetailIdArr
)
->
update
([
'pick_status'
=>
4
]);
PickTaskDetailModel
::
where
(
'pick_task_detail_id'
,
$
pickTask
DetailIdArr
)
->
update
([
'pick_status'
=>
4
]);
}
DB
::
commit
();
...
...
@@ -445,9 +578,9 @@ class PickTaskLogic
}
static
public
function
checkIsPackCheck
(
$
outStore
DetailIdArr
,
$msg
=
'请求错误'
)
static
public
function
checkIsPackCheck
(
$
pickTask
DetailIdArr
,
$msg
=
'请求错误'
)
{
if
(
!
empty
(
PickTaskDetailModel
::
getWhereObj
([])
->
whereIn
(
'
out_store_detail_id'
,
$outStore
DetailIdArr
)
->
where
(
'pack_status'
,
'>'
,
1
)
->
value
(
'pick_task_detail_id'
))){
if
(
!
empty
(
PickTaskDetailModel
::
getWhereObj
([])
->
whereIn
(
'
pick_task_detail_id'
,
$pickTask
DetailIdArr
)
->
where
(
'pack_status'
,
'>'
,
1
)
->
value
(
'pick_task_detail_id'
))){
throw
new
\Exception
(
$msg
);
}
}
...
...
storage/laravels.json
View file @
04b5a429
This diff is collapsed.
Click to expand it.
storage/laravels.pid
View file @
04b5a429
92671
\ No newline at end of file
<<<<<<< HEAD
92671
=======
95547
>>>>>>> develop
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