优化预订单商品列表文件名生成逻辑

- 增加根据预订单ID获取商店名称的功能
- 添加截取预订单标记字符串的逻辑,限制长度为15个字符
- 组合商店名称和预订单标记作为文件名
- 优化后的文件名更具描述性和可读性
This commit is contained in:
mkm 2024-10-16 18:00:50 +08:00
parent 2ddd560df7
commit 31aee076c1

View File

@ -10,7 +10,9 @@ use app\common\model\purchase_product_offer\PurchaseProductOffer;
use app\common\model\store_product\StoreProduct;
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
use app\common\lists\ListsExcelInterface;
use app\common\model\beforehand_order\BeforehandOrder;
use app\common\model\store_product_unit\StoreProductUnit;
use app\common\model\system_store\SystemStore;
/**
* 预订单购物详情表列表
@ -101,7 +103,19 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
*/
public function setFileName(): string
{
return '预订单商品列表';
$id=$this->request->get('bhoid');
$find=BeforehandOrder::where('id',$id)->field('store_id,mark')->find();
$name='';
if($find['store_id']>0){
$name=SystemStore::where('id',$find['store_id'])->value('name');
}
if($find['mark']!=''){
$originalString = $find['mark'];
$length = 15; // 截断长度
$mark = substr($originalString, 0, $length);
$name.='-'.$mark;
}
return $name;
}