库存修改
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\common\service;
|
||||
|
||||
use app\common\model\InvItem;
|
||||
use app\common\model\User;
|
||||
use app\common\validate\InvRequisitionApproveValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
@@ -169,6 +170,7 @@ class InvRequisitionApproveService
|
||||
->count();
|
||||
if($action == 1){
|
||||
if(count($steps) == $pass){
|
||||
//判断是否都是消耗品,是否需要归还
|
||||
$requisitionItem = Db::table('inv_requisition_item')
|
||||
->where('requisition_id', $requisition->id)
|
||||
->where('is_consumable_snap', 0)
|
||||
@@ -179,6 +181,15 @@ class InvRequisitionApproveService
|
||||
Db::table('inv_requisition')->where('id', $requisition->id)->update(['status'=>19]);
|
||||
}
|
||||
|
||||
//更改库存
|
||||
$requisitionItem = Db::table('inv_requisition_item')
|
||||
->where('requisition_id', $requisition->id)
|
||||
->get();
|
||||
foreach ($requisitionItem as $item) {
|
||||
//$invItem = InvItem::where('id', $item->item_id)->first();
|
||||
(new InvItemService())->stockOut($item->item_id,$item->approved_qty);
|
||||
}
|
||||
|
||||
// $requisition->status = 12;
|
||||
// $requisition->save();
|
||||
return ['status' => 'complete', 'msg' => '已通过'];
|
||||
@@ -200,7 +211,7 @@ class InvRequisitionApproveService
|
||||
}
|
||||
|
||||
|
||||
// 4) 通过 => 进入下一步或结束
|
||||
// 4) 通过 => 进入下一步
|
||||
Db::table('inv_requisition')->where('id', $requisitionId)->update(['status'=>11]);
|
||||
$requisitionItem = Db::table('inv_requisition_item')->where('requisition_id', $requisitionId)->first();
|
||||
$item_id = Db::table('inv_item')->where('id', $requisitionItem->item_id)->first();
|
||||
|
||||
Reference in New Issue
Block a user