feat: 修改了仓库和商品相关的功能,包括库存统计、商品列表展示等
This commit is contained in:
parent
884f319ddb
commit
907584a400
@ -312,7 +312,7 @@ class WorkbenchController extends BaseAdminController
|
|||||||
public function total_warehouse_product_list()
|
public function total_warehouse_product_list()
|
||||||
{
|
{
|
||||||
$parmas=$this->request->get();
|
$parmas=$this->request->get();
|
||||||
$data =WarehouseLogic::total_warehouse_list($parmas,$parmas['type']??1);
|
$data =WarehouseLogic::total_warehouse_product_list($parmas,$parmas['type']??1);
|
||||||
return $this->data($data);
|
return $this->data($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,6 +209,7 @@ class WarehouseOrderController extends BaseAdminController
|
|||||||
public function export()
|
public function export()
|
||||||
{
|
{
|
||||||
$id = $this->request->post('id');
|
$id = $this->request->post('id');
|
||||||
|
$type = $this->request->post('type');
|
||||||
$xlsx = new OrderDetail();
|
$xlsx = new OrderDetail();
|
||||||
$order = WarehouseOrder::where('id', $id)->findOrEmpty();
|
$order = WarehouseOrder::where('id', $id)->findOrEmpty();
|
||||||
$system_store = SystemStore::where('id', $order['store_id'])->value('name');
|
$system_store = SystemStore::where('id', $order['store_id'])->value('name');
|
||||||
@ -218,7 +219,12 @@ class WarehouseOrderController extends BaseAdminController
|
|||||||
$find = StoreProduct::where('id', $value->product_id)->find();
|
$find = StoreProduct::where('id', $value->product_id)->find();
|
||||||
$value->store_name = $find['store_name'] ?? '';
|
$value->store_name = $find['store_name'] ?? '';
|
||||||
$value->store_info = $find['store_info'] ?? '';
|
$value->store_info = $find['store_info'] ?? '';
|
||||||
$value->price = $value['purchase'];
|
if($type==2){
|
||||||
|
$value->price = $find['price'];
|
||||||
|
$value->total_price=bcmul($find['price'],$value['nums'],2);
|
||||||
|
}else{
|
||||||
|
$value->price = $value['purchase'];
|
||||||
|
}
|
||||||
$value->cart_num = $value['nums'];
|
$value->cart_num = $value['nums'];
|
||||||
if (!empty($find['unit'])) {
|
if (!empty($find['unit'])) {
|
||||||
$value->unit_name = StoreProductUnit::where('id', $find['unit'])->value('name');
|
$value->unit_name = StoreProductUnit::where('id', $find['unit'])->value('name');
|
||||||
|
@ -60,6 +60,7 @@ class StoreExtractLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|||||||
}
|
}
|
||||||
$user_ship=UserShip::where('id',$find['user_ship'])->value('title');
|
$user_ship=UserShip::where('id',$find['user_ship'])->value('title');
|
||||||
$item->nickname=$name.'('.$user_ship.')';
|
$item->nickname=$name.'('.$user_ship.')';
|
||||||
|
// $item->id_card=$name.'('.$user_ship.')';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
@ -129,6 +129,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|||||||
'purchase' => '采购价',
|
'purchase' => '采购价',
|
||||||
'cost' => '商户',
|
'cost' => '商户',
|
||||||
'price' => '零售',
|
'price' => '零售',
|
||||||
|
'bar_code' => '条码',
|
||||||
];
|
];
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -98,10 +98,11 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
$item->admin_name = '';
|
$item->admin_name = '';
|
||||||
}
|
}
|
||||||
if ($item->product_id) {
|
if ($item->product_id) {
|
||||||
$find = StoreProduct::where('id', $item->product_id)->field('image,store_name')->find();
|
$find = StoreProduct::where('id', $item->product_id)->field('price,image,store_name')->find();
|
||||||
if($find){
|
if($find){
|
||||||
$item->store_name = $find->store_name . '|' . $item->product_id;
|
$item->store_name = $find->store_name . '|' . $item->product_id;
|
||||||
$item->image = $find->image;
|
$item->image = $find->image;
|
||||||
|
$item->price = $find->price;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$item->store_name = '';
|
$item->store_name = '';
|
||||||
|
@ -56,7 +56,7 @@ class WarehouseLogic extends BaseLogic
|
|||||||
'title' => '总商品库存',
|
'title' => '总商品库存',
|
||||||
'desc' => '平台统计商品总库存、含门店仓库',
|
'desc' => '平台统计商品总库存、含门店仓库',
|
||||||
'total_money' => bcadd($store_stock_1, $store_stock_2, 2),
|
'total_money' => bcadd($store_stock_1, $store_stock_2, 2),
|
||||||
'cash_title' => 0,
|
'cash_title' => 1,
|
||||||
'value' => [],
|
'value' => [],
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
];
|
];
|
||||||
@ -64,7 +64,7 @@ class WarehouseLogic extends BaseLogic
|
|||||||
'title' => '总仓库库存',
|
'title' => '总仓库库存',
|
||||||
'desc' => '平台统计仓库库存',
|
'desc' => '平台统计仓库库存',
|
||||||
'total_money' => WarehouseProductStorege::sum('nums'),
|
'total_money' => WarehouseProductStorege::sum('nums'),
|
||||||
'cash_title' => 0,
|
'cash_title' => 1,
|
||||||
'value' => [],
|
'value' => [],
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
];
|
];
|
||||||
@ -72,7 +72,7 @@ class WarehouseLogic extends BaseLogic
|
|||||||
'title' => '海吉星仓库库存',
|
'title' => '海吉星仓库库存',
|
||||||
'desc' => '平台统计海吉星仓库库存',
|
'desc' => '平台统计海吉星仓库库存',
|
||||||
'total_money' => WarehouseProductStorege::where('warehouse_id', 1)->sum('nums'),
|
'total_money' => WarehouseProductStorege::where('warehouse_id', 1)->sum('nums'),
|
||||||
'cash_title' => 0,
|
'cash_title' => 1,
|
||||||
'value' => [],
|
'value' => [],
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
];
|
];
|
||||||
@ -80,7 +80,7 @@ class WarehouseLogic extends BaseLogic
|
|||||||
'title' => '泸县集采集配库存',
|
'title' => '泸县集采集配库存',
|
||||||
'desc' => '平台统计泸县集采集配库存',
|
'desc' => '平台统计泸县集采集配库存',
|
||||||
'total_money' => WarehouseProductStorege::where('warehouse_id', 2)->sum('nums'),
|
'total_money' => WarehouseProductStorege::where('warehouse_id', 2)->sum('nums'),
|
||||||
'cash_title' => 0,
|
'cash_title' => 1,
|
||||||
'value' => [],
|
'value' => [],
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
];
|
];
|
||||||
@ -88,7 +88,7 @@ class WarehouseLogic extends BaseLogic
|
|||||||
'title' => '总门店库存',
|
'title' => '总门店库存',
|
||||||
'desc' => '平台统计门店库存',
|
'desc' => '平台统计门店库存',
|
||||||
'total_money' => StoreBranchProduct::sum('stock'),
|
'total_money' => StoreBranchProduct::sum('stock'),
|
||||||
'cash_title' => 0,
|
'cash_title' => 1,
|
||||||
|
|
||||||
'value' => [],
|
'value' => [],
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
@ -156,7 +156,7 @@ class WarehouseLogic extends BaseLogic
|
|||||||
$count=WarehouseProduct::where($where)->count();
|
$count=WarehouseProduct::where($where)->count();
|
||||||
}elseif($type==2){
|
}elseif($type==2){
|
||||||
//已结算采购价
|
//已结算采购价
|
||||||
$where=[['product_id','=',$parmas['product_id']],['nums','>',0],['financial_pm','=',1]];
|
$where=[['product_id','=',$parmas['product_id']],['nums','>',0],['financial_pm','=',1],['is_pay','=',1]];
|
||||||
$list=WarehouseProduct::where($where)->select()->each(function ($item){
|
$list=WarehouseProduct::where($where)->select()->each(function ($item){
|
||||||
$item->warehouse_name = Warehouse::where('id',$item['warehouse_id'])->value('name');
|
$item->warehouse_name = Warehouse::where('id',$item['warehouse_id'])->value('name');
|
||||||
$item->supplier_name = Supplier::where('id',$item['supplier_id'])->value('mer_name');
|
$item->supplier_name = Supplier::where('id',$item['supplier_id'])->value('mer_name');
|
||||||
@ -167,7 +167,7 @@ class WarehouseLogic extends BaseLogic
|
|||||||
$count=WarehouseProduct::where($where)->count();
|
$count=WarehouseProduct::where($where)->count();
|
||||||
}elseif($type==3){
|
}elseif($type==3){
|
||||||
//未结算采购价
|
//未结算采购价
|
||||||
$where=[['product_id','=',$parmas['product_id']],['nums','>',0],['financial_pm','=',1]];
|
$where=[['product_id','=',$parmas['product_id']],['nums','>',0],['financial_pm','=',1],['is_pay','=',0]];
|
||||||
$list=WarehouseProduct::where($where)->select()->each(function ($item){
|
$list=WarehouseProduct::where($where)->select()->each(function ($item){
|
||||||
$item->warehouse_name = Warehouse::where('id',$item['warehouse_id'])->value('name');
|
$item->warehouse_name = Warehouse::where('id',$item['warehouse_id'])->value('name');
|
||||||
$item->supplier_name = Supplier::where('id',$item['supplier_id'])->value('mer_name');
|
$item->supplier_name = Supplier::where('id',$item['supplier_id'])->value('mer_name');
|
||||||
|
@ -208,7 +208,7 @@ class IndexController extends BaseApiController
|
|||||||
public function config()
|
public function config()
|
||||||
{
|
{
|
||||||
//处理返回最近的店铺
|
//处理返回最近的店铺
|
||||||
$params=$this->request->get();
|
$params = $this->request->get();
|
||||||
if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) {
|
if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) {
|
||||||
$latitude = $params['lat'];
|
$latitude = $params['lat'];
|
||||||
$longitude = $params['long'];
|
$longitude = $params['long'];
|
||||||
@ -216,10 +216,15 @@ class IndexController extends BaseApiController
|
|||||||
$distanceSql = "SQRT(POW(69.1 * (latitude - {$latitude}), 2) +
|
$distanceSql = "SQRT(POW(69.1 * (latitude - {$latitude}), 2) +
|
||||||
POW(69.1 * ({$longitude} - longitude) * COS(latitude / 57.3), 2))";
|
POW(69.1 * ({$longitude} - longitude) * COS(latitude / 57.3), 2))";
|
||||||
$find = SystemStore::field("id, name,abbreviation, {$distanceSql} AS distance")
|
$find = SystemStore::field("id, name,abbreviation, {$distanceSql} AS distance")
|
||||||
|
->where('is_show', '=', 1)
|
||||||
->where('latitude', '<>', '')
|
->where('latitude', '<>', '')
|
||||||
->where('longitude', '<>', '')
|
->where('longitude', '<>', '')
|
||||||
->order('distance', 'asc') // 根据距离排序
|
->order('distance', 'asc') // 根据距离排序
|
||||||
->find();
|
->find();
|
||||||
|
if (!$find) {
|
||||||
|
$store_id = getenv('STORE_ID') ?? 1;
|
||||||
|
$find = SystemStore::where('id', $store_id)->find();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$store_id = getenv('STORE_ID') ?? 1;
|
$store_id = getenv('STORE_ID') ?? 1;
|
||||||
$find = SystemStore::where('id', $store_id)->find();
|
$find = SystemStore::where('id', $store_id)->find();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user