feat(inventory_transfer): 商品调拨列表增加导出功能并优化数据查询
- 在 InventoryTransferLists 类中添加了 ListsExcelInterface 接口实现 - 优化了商品信息查询,增加了价格和总价字段 - 修改了导出文件名和导出字段 - 在 OrderAllocation 和 OrderOutbound 类中进行了 minor 修改
This commit is contained in:
parent
9e32210670
commit
ea817c25ae
@ -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;
|
||||
}
|
||||
}
|
@ -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']??'');
|
||||
|
@ -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),'出库金额:');
|
||||
|
Loading…
x
Reference in New Issue
Block a user