diff --git a/application/admin/form/Warehousegoods.php b/application/admin/form/Warehousegoods.php index 730a7b720..086ca3956 100644 --- a/application/admin/form/Warehousegoods.php +++ b/application/admin/form/Warehousegoods.php @@ -153,7 +153,11 @@ class Warehousegoods $ids = array_unique(Db::name('WarehouseGoods')->column('warehouse_id')); if(!empty($ids)) { - $result = Db::name('Warehouse')->field('id,name')->where(['id'=>$ids, 'is_delete_time'=>0])->select(); + $ret = WarehouseService::WarehouseIdsAllList($ids); + if($ret['code'] == 0) + { + $result = $ret['data']; + } } return $result; } diff --git a/application/admin/view/default/warehouse/index.html b/application/admin/view/default/warehouse/index.html index b2aec03ba..f40bdf079 100644 --- a/application/admin/view/default/warehouse/index.html +++ b/application/admin/view/default/warehouse/index.html @@ -8,10 +8,12 @@ {__block__} {{/block}} + {{block name="form_extend"}}
-

1. 权重(数值越大权重越高、扣除库存按照权重依次扣除)

-

2. 删除(数据仅软删除、删除后仓库将不可用、仅数据库中保留数据)

+

1. 权重数值越大代表权重越高、扣除库存按照权重依次扣除)

+

2. 仓库仅软删除、删除后将不可用、仅数据库中保留数据)可以自行删除关联的商品数据

+

3. 仓库停用和删除、关联的商品库存会立即释放

{{/block}} \ No newline at end of file diff --git a/application/service/WarehouseGoodsService.php b/application/service/WarehouseGoodsService.php index 4a880e689..d9c38aa00 100644 --- a/application/service/WarehouseGoodsService.php +++ b/application/service/WarehouseGoodsService.php @@ -14,6 +14,7 @@ use think\Db; use app\service\ResourcesService; use app\service\GoodsService; use app\service\UserService; +use app\service\WarehouseService; /** * 仓库商品服务层 @@ -87,7 +88,15 @@ class WarehouseGoodsService // 仓库名称 if(in_array('warehouse_id', $keys)) { - $warehouse = Db::name('Warehouse')->where(['id'=>array_column($data, 'warehouse_id')])->column('name', 'id'); + $warehouse = []; + $w_ret = WarehouseService::WarehouseIdsAllList(array_column($data, 'warehouse_id')); + if(!empty($w_ret['data'])) + { + foreach($w_ret['data'] as $wv) + { + $warehouse[$wv['id']] = $wv['name']; + } + } } // 数据处理 diff --git a/application/service/WarehouseService.php b/application/service/WarehouseService.php index 63d02852b..e25163a4f 100644 --- a/application/service/WarehouseService.php +++ b/application/service/WarehouseService.php @@ -338,5 +338,41 @@ class WarehouseService } return DataReturn('处理成功', 0); } + + /** + * 通过库存id获取所有的仓库列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-08-18 + * @desc description + * @param [array] $ids [仓库id] + */ + public static function WarehouseIdsAllList($ids) + { + $result = []; + $data = Db::name('Warehouse')->field('id,name,is_enable,is_delete_time')->where(['id'=>array_unique($ids)])->select(); + if(!empty($data)) + { + foreach($data as $v) + { + $err = []; + if($v['is_enable'] != 1) + { + $err[] = '未启用'; + } + if($v['is_delete_time'] > 0) + { + $err[] = '已删除'; + } + if(!empty($err)) + { + $v['name'] .= '('.implode('/', $err).')'; + } + $result[] = $v; + } + } + return DataReturn('处理成功', 0, $result); + } } ?> \ No newline at end of file