From ea817c25ae4287713fec9caf2314c61dc53543b1 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 12 Nov 2024 14:14:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(inventory=5Ftransfer):=20=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=B0=83=E6=8B=A8=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 InventoryTransferLists 类中添加了 ListsExcelInterface 接口实现 - 优化了商品信息查询,增加了价格和总价字段 - 修改了导出文件名和导出字段 - 在 OrderAllocation 和 OrderOutbound 类中进行了 minor 修改 --- .../InventoryTransferLists.php | 45 ++++++++++++++++++- app/common/service/xlsx/OrderAllocation.php | 2 +- app/common/service/xlsx/OrderOutbound.php | 4 +- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/app/admin/lists/inventory_transfer/InventoryTransferLists.php b/app/admin/lists/inventory_transfer/InventoryTransferLists.php index 201538979..858f69aa2 100644 --- a/app/admin/lists/inventory_transfer/InventoryTransferLists.php +++ b/app/admin/lists/inventory_transfer/InventoryTransferLists.php @@ -9,13 +9,14 @@ use app\common\lists\ListsSearchInterface; use app\common\model\store_product\StoreProduct; use app\common\model\system_store\SystemStore; use app\common\model\warehouse\Warehouse; +use app\common\lists\ListsExcelInterface; /** * 商品调拨列表 * Class InventoryTransferLists * @package app\admin\listsinventory_transfer */ -class InventoryTransferLists extends BaseAdminDataLists implements ListsSearchInterface +class InventoryTransferLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface { public $ids; @@ -74,7 +75,10 @@ class InventoryTransferLists extends BaseAdminDataLists implements ListsSearchIn ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item){ - $item->store_name= StoreProduct::where('id',$item->product_id)->value('store_name'); + $find= StoreProduct::where('id',$item->product_id)->withTrashed()->field('store_name,price')->find(); + $item->store_name=$find['store_name']; + $item->price=$find['price']; + $item->total_price=bcmul($find['price'],$item['nums'],2); $type_name=''; if($item->one_type==1){ $item->one_name=SystemStore::where('id',$item->one_id)->value('name'); @@ -116,4 +120,41 @@ class InventoryTransferLists extends BaseAdminDataLists implements ListsSearchIn } } + /** + * @notes 导出文件名 + * @return string + * @author 乔峰 + * @date 2022/11/24 16:17 + */ + public function setFileName(): string + { + return '商品调拨列表'; + } + + + /** + * @notes 导出字段 + * @return string[] + * @author 乔峰 + * @date 2022/11/24 16:17 + */ + public function setExcelFields(): array + { + $data = [ + 'store_name' => '商品名称', + 'one_before_nums' => '数量', + 'one_name' => '转出方', + 'one_before_nums' => '转出前数量', + 'one_after_nums' => '转出后数量', + 'two_name' => '转入方', + 'two_before_nums' => '转入前数量', + 'two_after_nums' => '转入后数量', + 'price' => '零售价', + 'total_price' => '总价', + 'type_name' => '类型', + 'create_time' => '时间', + + ]; + return $data; + } } \ No newline at end of file diff --git a/app/common/service/xlsx/OrderAllocation.php b/app/common/service/xlsx/OrderAllocation.php index 94e4f83cf..83ac3ace0 100644 --- a/app/common/service/xlsx/OrderAllocation.php +++ b/app/common/service/xlsx/OrderAllocation.php @@ -125,7 +125,7 @@ class OrderAllocation $sheet->setCellValue('K' . ($count + 8),'门店'); $sheet->setCellValue('L' . ($count + 8),$other_data->system_store_name??''); $sheet->setCellValue('M' . ($count + 8),'区域经理'); - $sheet->setCellValue('N' . ($count + 8),$other_data->regional_manager??''); + $sheet->setCellValue('N' . ($count + 8),$other_data->regional_manager??'张波'); $sheet->setCellValue('A' . ($count + 9),'接单时间'); $sheet->setCellValue('B' . ($count + 9),$order['create_time']??''); diff --git a/app/common/service/xlsx/OrderOutbound.php b/app/common/service/xlsx/OrderOutbound.php index 72fd96d30..c235a7b3d 100644 --- a/app/common/service/xlsx/OrderOutbound.php +++ b/app/common/service/xlsx/OrderOutbound.php @@ -74,10 +74,10 @@ class OrderOutbound $sheet->setCellValue('A' . ($count + 5),'累计接单:'); $sheet->setCellValue('C' . ($count + 5),'预收金额:'); - $sheet->setCellValue('D' . ($count + 5),$order['total_price']); + $sheet->setCellValue('D' . ($count + 5),0); $sheet->setCellValue('E' . ($count + 5),'预收押金:'); $sheet->setCellValue('G' . ($count + 5),'合计预收:'); - $sheet->setCellValue('H' . ($count + 5),$order['total_price']); + $sheet->setCellValue('H' . ($count + 5),0); $sheet->setCellValue('A' . ($count + 6),'出库合计:'); $sheet->setCellValue('C' . ($count + 6),'出库金额:');