['warehouse_id', 'id'], '%like' => ['code'], 'between_time' => 'create_time' ]; } /** * @notes 获取仓储商品单列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author admin * @date 2024/08/20 10:50 */ public function lists(): array { return PurchaseOrder::where($this->searchWhere) ->field(['id', 'code', 'admin_id','warehouse_id', 'mark', 'total_price', 'status', 'create_time', 'oid', 'order_type']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item) { if ($item->admin_id) { $item->admin_name = Admin::where('id', $item->admin_id)->value('name'); } else { $item->admin_name = ''; } if ($item->warehouse_id) { $item->warehouse_name = Warehouse::where('id', $item->warehouse_id)->value('name'); } else { $item->warehouse_name = ''; } if (!empty($item['order_type'])) { $item->order_type_name = getOrderTypeName($item->order_type); } }) ->toArray(); } /** * @notes 获取仓储商品单数量 * @return int * @author admin * @date 2024/08/20 10:50 */ public function count(): int { return PurchaseOrder::where($this->searchWhere)->count(); } /** * @notes 导出文件名 * @return string * @date 2022/11/24 16:17 */ public function setFileName(): string { $financial_pm = $this->request->get('financial_pm'); if ($financial_pm == 0) { return '出库单列表'; } else { return '入库单列表'; } } /** * @notes 导出字段 * @return string[] * @date 2022/11/24 16:17 */ public function setExcelFields(): array { $data = [ 'create_time' => '操作时间', 'warehouse_name' => '仓库', 'code' => '单号', 'admin_name' => '填写人员', 'total_price' => '总金额', 'mark' => '备注', ]; return $data; } }