Merge pull request 'feat(inventory_transfer): 添加订单号搜索功能并更新列表显示' (#544) from dev into main

Reviewed-on: #544
This commit is contained in:
mkm 2025-03-11 11:03:57 +08:00
commit d21f8f9153

View File

@ -10,6 +10,7 @@ use app\common\model\store_product\StoreProduct;
use app\common\model\system_store\SystemStore; use app\common\model\system_store\SystemStore;
use app\common\model\warehouse\Warehouse; use app\common\model\warehouse\Warehouse;
use app\common\lists\ListsExcelInterface; use app\common\lists\ListsExcelInterface;
use app\common\model\inventory_transfer_order\InventoryTransferOrder;
/** /**
* 商品调拨列表 * 商品调拨列表
@ -59,23 +60,23 @@ class InventoryTransferLists extends BaseAdminDataLists implements ListsSearchIn
return []; return [];
} }
} }
if ($this->request->get('bar_code')) { if ($this->request->get('order_id')) {
$this->bar_code = $this->request->get('bar_code'); $this->store_name = $this->request->get('order_id');
$ids = StoreProduct::where('bar_code', 'like', '%' . $this->bar_code . '%')->column('id'); $ids = InventoryTransferOrder::where('order_id', 'like', $this->request->get('order_id') . '%')->column('id');
if ($ids) { if ($ids) {
$this->searchWhere[] = ['product_id', 'in', $ids]; $this->searchWhere[] = ['oid', 'in', $ids];
$this->ids = $ids; $this->ids = $ids;
} else { } else {
return []; return [];
} }
} }
return InventoryTransfer::where($this->searchWhere) return InventoryTransfer::where($this->searchWhere)
->field(['id', 'product_id', 'nums', 'one_before_nums', 'one_after_nums','two_before_nums','two_after_nums', 'one_type','two_type', 'one_id', 'two_id', 'create_time']) ->field(['id','oid', 'product_id', 'nums', 'one_before_nums', 'one_after_nums','two_before_nums','two_after_nums', 'one_type','two_type', 'one_id', 'two_id', 'create_time'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function($item){ ->select()->each(function($item){
$find= StoreProduct::where('id',$item->product_id)->withTrashed()->field('store_name,price')->find(); $find= StoreProduct::where('id',$item->product_id)->withTrashed()->field('store_name,price')->find();
$item->order_id= InventoryTransferOrder::where('id',$item->oid)->value('order_id');
$item->store_name=$find['store_name']; $item->store_name=$find['store_name'];
$item->price=$find['price']; $item->price=$find['price'];
$item->total_price=bcmul($find['price'],$item['nums'],2); $item->total_price=bcmul($find['price'],$item['nums'],2);
@ -141,6 +142,7 @@ class InventoryTransferLists extends BaseAdminDataLists implements ListsSearchIn
public function setExcelFields(): array public function setExcelFields(): array
{ {
$data = [ $data = [
'order_id' => '订单号',
'store_name' => '商品名称', 'store_name' => '商品名称',
'one_before_nums' => '数量', 'one_before_nums' => '数量',
'one_name' => '转出方', 'one_name' => '转出方',