Merge pull request 'feat(admin): 仓库订单列表支持按仓库类型筛选' (#330) from dev into main
Reviewed-on: #330
This commit is contained in:
commit
b3dd4008d9
@ -17,7 +17,7 @@ use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo;
|
||||
* Class BeforehandOrderLists
|
||||
* @package app\admin\listsbeforehand_order
|
||||
*/
|
||||
class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
|
||||
class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
@ -30,8 +30,8 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['store_id','paid','status','order_type','order_sn'],
|
||||
'%like'=>['order_id'],
|
||||
'=' => ['store_id', 'paid', 'status', 'order_type', 'order_sn'],
|
||||
'%like' => ['order_id'],
|
||||
'between_time' => 'create_time'
|
||||
];
|
||||
}
|
||||
@ -48,57 +48,76 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$warehouse_type = $this->request->get('warehouse_type', 0);
|
||||
|
||||
switch ($warehouse_type) {
|
||||
case 1:
|
||||
$this->searchWhere[] = ['is_outbound', '=', 0];
|
||||
$this->searchWhere[] = ['order_type', '<>', 5];
|
||||
break;
|
||||
case 2:
|
||||
$this->searchWhere[] = ['is_outbound', '=', 1];
|
||||
break;
|
||||
case 3:
|
||||
$this->searchWhere[] = ['is_warehousing', '=', 0];
|
||||
break;
|
||||
case 4:
|
||||
$this->searchWhere[] = ['is_warehousing', '=', 1];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return BeforehandOrder::where($this->searchWhere)
|
||||
->field(['id','order_id','store_id','order_type','total_num','total_price','outbound_id','admin_id','create_time', 'status', 'mark','warehousing_id','file'])
|
||||
->field(['id', 'order_id', 'store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item){
|
||||
$item['outbound']='';
|
||||
if($item->admin_id){
|
||||
$item->admin_name=Admin::where(['id'=>$item->admin_id])->value('name');
|
||||
}else{
|
||||
$item->admin_name='';
|
||||
->select()->each(function ($item) {
|
||||
$item['outbound'] = '';
|
||||
if ($item->admin_id) {
|
||||
$item->admin_name = Admin::where(['id' => $item->admin_id])->value('name');
|
||||
} else {
|
||||
$item->admin_name = '';
|
||||
}
|
||||
if($item->order_type==1){
|
||||
$item->order_type_name='铺货订单';
|
||||
}elseif($item->order_type==2){
|
||||
$item->order_type_name='商贩订单';
|
||||
}elseif($item->order_type==3){
|
||||
$item->order_type_name='一条龙订单';
|
||||
}elseif($item->order_type==4){
|
||||
$item->order_type_name='线上订单';
|
||||
}elseif($item->order_type==5){
|
||||
$item->order_type_name='仓库补货';
|
||||
$item->outbound='无须出库';
|
||||
}elseif($item->order_type==6){
|
||||
$item->order_type_name='往期补单';
|
||||
if ($item->order_type == 1) {
|
||||
$item->order_type_name = '铺货订单';
|
||||
} elseif ($item->order_type == 2) {
|
||||
$item->order_type_name = '商贩订单';
|
||||
} elseif ($item->order_type == 3) {
|
||||
$item->order_type_name = '一条龙订单';
|
||||
} elseif ($item->order_type == 4) {
|
||||
$item->order_type_name = '线上订单';
|
||||
} elseif ($item->order_type == 5) {
|
||||
$item->order_type_name = '仓库补货';
|
||||
$item->outbound = '无须出库';
|
||||
} elseif ($item->order_type == 6) {
|
||||
$item->order_type_name = '往期补单';
|
||||
}
|
||||
$item->msg='';
|
||||
$count1=PurchaseProductOffer::where('order_id',$item->id)->where('buyer_confirm',0)->count('id');
|
||||
if($count1>0){
|
||||
$item->msg='有'.$count1.'个商品采购中';
|
||||
}else{
|
||||
$count2=PurchaseProductOffer::where('order_id',$item->id)->where('buyer_confirm',1)->count('id');
|
||||
if($count2>0 &&$item['warehousing_id']==0){
|
||||
$item->msg='商品没有入库';
|
||||
$item->msg = '';
|
||||
$count1 = PurchaseProductOffer::where('order_id', $item->id)->where('buyer_confirm', 0)->count('id');
|
||||
if ($count1 > 0) {
|
||||
$item->msg = '有' . $count1 . '个商品采购中';
|
||||
} else {
|
||||
$count2 = PurchaseProductOffer::where('order_id', $item->id)->where('buyer_confirm', 1)->count('id');
|
||||
if ($count2 > 0 && $item['warehousing_id'] == 0) {
|
||||
$item->msg = '商品没有入库';
|
||||
}
|
||||
}
|
||||
if($item->msg==''){
|
||||
$count=BeforehandOrderCartInfo::where('is_buyer',0)->where('bhoid',$item['id'])->count('id');
|
||||
if($count>0){
|
||||
$item->msg='有'.$count.'个商品未设置';
|
||||
if ($item->msg == '') {
|
||||
$count = BeforehandOrderCartInfo::where('is_buyer', 0)->where('bhoid', $item['id'])->count('id');
|
||||
if ($count > 0) {
|
||||
$item->msg = '有' . $count . '个商品未设置';
|
||||
}
|
||||
}
|
||||
$item['warehousing']='';
|
||||
$item['system_store']='';
|
||||
if($item['warehousing_id']>0){
|
||||
$item->warehousing='已入库|'.$item['warehousing_id'];
|
||||
$item['warehousing'] = '';
|
||||
$item['system_store'] = '';
|
||||
if ($item['warehousing_id'] > 0) {
|
||||
$item->warehousing = '已入库|' . $item['warehousing_id'];
|
||||
}
|
||||
if($item['outbound_id']>0){
|
||||
$item->outbound='已出库|'.$item['outbound_id'];
|
||||
if ($item['outbound_id'] > 0) {
|
||||
$item->outbound = '已出库|' . $item['outbound_id'];
|
||||
}
|
||||
if($item['store_id']>0){
|
||||
$item->system_store=SystemStore::where(['id'=>$item['store_id']])->value('name');
|
||||
if ($item['store_id'] > 0) {
|
||||
$item->system_store = SystemStore::where(['id' => $item['store_id']])->value('name');
|
||||
}
|
||||
})
|
||||
->toArray();
|
||||
@ -115,7 +134,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
||||
{
|
||||
return BeforehandOrder::where($this->searchWhere)->count();
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* @notes 导出文件名
|
||||
* @return string
|
||||
* @author 乔峰
|
||||
@ -136,10 +155,10 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
$data=[
|
||||
'id'=>'ID',
|
||||
'order_id'=>'单号',
|
||||
'order_type_name'=>'订单类型',
|
||||
$data = [
|
||||
'id' => 'ID',
|
||||
'order_id' => '单号',
|
||||
'order_type_name' => '订单类型',
|
||||
'system_store' => '门店',
|
||||
'admin_name' => '门店',
|
||||
'warehousing' => '入库',
|
||||
@ -152,4 +171,4 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
WarehouseProductLogic::add($data);
|
||||
PurchaseProductOffer::where('id', $v['id'])->update(['status' => 1, 'is_storage' => 1]);
|
||||
}
|
||||
BeforehandOrder::where('id', $params['bhoid'])->update(['warehousing_id' => $res['id']]);
|
||||
BeforehandOrder::where('id', $params['bhoid'])->update(['warehousing_id' => $res['id'],'is_warehousing'=>1]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user