52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace app\common\logic;
|
|
|
|
use app\common\traits\crud\CrudLogicTrait;
|
|
use app\common\model\PurchaseOrders;
|
|
use app\common\model\StockOrderItems;
|
|
use app\common\utils\CrudUtil;
|
|
use app\common\model\StockOrders;
|
|
|
|
class PurchaseOrdersLogic
|
|
{
|
|
use CrudLogicTrait;
|
|
|
|
/**
|
|
* 指定当前要操作的模型
|
|
*/
|
|
protected string $modelClass = PurchaseOrders::class;
|
|
|
|
|
|
/**
|
|
* 获取备货单PI号
|
|
*/
|
|
public function getPiList()
|
|
{
|
|
return (new StockOrders())->where('pi_no', '!=', '')
|
|
->select('pi_no', 'salesperson_snapshot')
|
|
->distinct()
|
|
->get();
|
|
}
|
|
|
|
/**
|
|
* 根据PI号获取备货单
|
|
*/
|
|
public function getOrderNoListByPiNo($piNo)
|
|
{
|
|
return (new StockOrders())->where('pi_no', $piNo)
|
|
->where('approval_status', 2)
|
|
->select('order_no', 'biz_date', 'salesperson_snapshot', 'id as stock_orders_id', 'salesperson_id')
|
|
->get();
|
|
}
|
|
|
|
/**
|
|
* 根据备货单号获取备货单明细
|
|
*/
|
|
public function getOrderItemsListByOrderNo($stockOrdersId)
|
|
{
|
|
return (new StockOrderItems())->where('order_id', $stockOrdersId)
|
|
->select('model_snapshot', 'color_interior_snapshot', 'color_exterior_snapshot', 'unique_id', 'id as stock_order_items_id')
|
|
->get();
|
|
}
|
|
} |