添加预订单转欠款
This commit is contained in:
parent
a1517c1aba
commit
025a143de9
@ -353,5 +353,13 @@ class BeforehandOrderController extends BaseAdminController
|
|||||||
BeforehandOrderLogic::copy($params);
|
BeforehandOrderLogic::copy($params);
|
||||||
return $this->success('复制成功');
|
return $this->success('复制成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function transfer()
|
||||||
|
{
|
||||||
|
$params = $this->request->post();
|
||||||
|
$params['admin_id'] = $this->adminId;
|
||||||
|
BeforehandOrderLogic::transfer($params);
|
||||||
|
return $this->success('操作成功');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
|||||||
$oid=WarehouseOrder::where('financial_pm',0)->where('code','like','%'.$order_ck)->column('id');
|
$oid=WarehouseOrder::where('financial_pm',0)->where('code','like','%'.$order_ck)->column('id');
|
||||||
$this->searchWhere[] = ['outbound_id','in',$oid];
|
$this->searchWhere[] = ['outbound_id','in',$oid];
|
||||||
}
|
}
|
||||||
$file=['id','uid', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file','other_data', 'audit_status', 'store_staff_id'];
|
$file=['id','uid', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file','other_data', 'audit_status', 'store_staff_id', 'is_arrears'];
|
||||||
$query = BeforehandOrder::where($this->searchWhere);
|
$query = BeforehandOrder::where($this->searchWhere);
|
||||||
return $query
|
return $query
|
||||||
->field($file)
|
->field($file)
|
||||||
|
@ -1133,4 +1133,21 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function transfer($params)
|
||||||
|
{
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$order = BeforehandOrder::where('id', $params['id'])->findOrEmpty()->toArray();
|
||||||
|
if ($order['is_arrears'] != 1) {
|
||||||
|
throw new BusinessException('该订单已转欠款');
|
||||||
|
}
|
||||||
|
AccountsReceivableLogic::add($order);
|
||||||
|
BeforehandOrder::where('id', $params['id'])->update(['is_arrears' => 2]);
|
||||||
|
Db::commit();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user