115 lines
7.6 KiB
PHP
115 lines
7.6 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\common\controller\Api;
|
|
use app\common\model\User;
|
|
use think\Hook;
|
|
use fast\Random;
|
|
|
|
class Produce extends Api
|
|
{
|
|
protected $noNeedLogin = '';
|
|
protected $noNeedRight = '';
|
|
|
|
public function index(){
|
|
$params=$this->request->post();
|
|
$storeid=isset($params['storeid'])?$params['storeid']:0;
|
|
$where2 = $storeid?'STOREID='.$storeid:'';
|
|
//print_r($storeid);
|
|
//print_r($where2);die();
|
|
$WAREHOUSEID = $this->auth->warehouseid;
|
|
$orderModel = new \app\common\model\wms\Order;
|
|
try {
|
|
$where = 'POSTNUM=\'\'';
|
|
$dfp = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
|
|
$where = 'PRINTTIMES=0 and POSTFLAG=1';
|
|
$ddy = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'PRINTTIMES=1 and PICKINGFLAG=0 and OPERATERECORDS not like \'%领料%\' and GRABNUM != \'\'';
|
|
$dll = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'PICKINGFLAG=0 and OPERATERECORDS like \'%领料%\'';
|
|
$djh = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'POSTFLAG=1 and OPERATERECORDS not like \'%揽收%\'';
|
|
$dls = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'POSTFLAG=1 and OPERATERECORDS like \'%揽收%\'';
|
|
$yls = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'PICKINGFLAG=3 and PLSENDFLAG=0';
|
|
$dfh = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'PLSENDFLAG=1 and WEIGHT = \'\'';
|
|
$dcz = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'PLSENDFLAG=1 and OPERATERECORDS not like \'%打包%\'';
|
|
$ddb = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = '';
|
|
$yjd = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'POSTFLAG=1';
|
|
$yfp = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'PRINTTIMES=1';
|
|
$ydy = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'OPERATERECORDS like \'%领料%\' or PICKINGFLAG=3';
|
|
$yll = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'PICKINGFLAG=3';
|
|
$yjh = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'PLSENDFLAG=1';
|
|
$yfh = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'WEIGHT <> \'\'';
|
|
$ycz = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'OPERATERECORDS like \'%打包%\'';
|
|
$ydb = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$where = 'FLAG=1';
|
|
$ylj = $orderModel->where($where)->where($where2)->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000)->where(['WAREHOUSEID'=>$WAREHOUSEID])->count();
|
|
$this->success('获取成功',['dfp'=>$dfp,'ddy'=>$ddy,'dll'=>$dll,'djh'=>$djh,'dfh'=>$dfh,'dcz'=>$dcz,'ddb'=>$ddb,'yjd'=>$yjd,'yfp'=>$yfp,'ydy'=>$ydy,'yll'=>$yll,'yjh'=>$yjh,'yfh'=>$yfh,'ydb'=>$ydb,'ycz'=>$ycz,'ylj'=>$ylj,'dls'=>$dls,'yls'=>$yls]);
|
|
} catch (Exception $e) {
|
|
$this->error($e);
|
|
}
|
|
}
|
|
public function query(){
|
|
$params=$this->request->post();
|
|
$WAREHOUSEID = $this->auth->warehouseid;
|
|
$orderModel = new \app\common\model\wms\Order;
|
|
$Model2 = new \app\common\model\wms\Order;
|
|
$query = $orderModel->where(["WAREHOUSEID"=>$WAREHOUSEID])->where($params['query']['wherest'])
|
|
->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000);
|
|
if($params['query']['group']=='GRABNUM'){
|
|
$query->group('GRABNUM');
|
|
}
|
|
Db::startTrans();
|
|
try {
|
|
$count = $query->count();
|
|
$query = $orderModel->where(["WAREHOUSEID"=>$WAREHOUSEID])->where($params['query']['wherest'])
|
|
->where('cast(CREATIONDATE as signed) >= '.strtotime(date("Y-m-d",strtotime("-30 day")))*1000);
|
|
if($params['query']['group']=='GRABNUM'){
|
|
$query->group('GRABNUM');
|
|
}
|
|
$query->limit($params['query']['pagesize']*($params['query']['page']-1),$params['query']['pagesize']);
|
|
$list = $query->select();
|
|
foreach($list as $r){
|
|
$StoreModel = new \app\common\model\wms\Store;
|
|
$store = $StoreModel->where(['STOREID'=>$r['STOREID']])->find();
|
|
$r['huozhu'] = $store['TITLE'];
|
|
}
|
|
Db::commit();
|
|
} catch (ValidateException|PDOException|Exception $e) {
|
|
Db::rollback();
|
|
$this->error($e->getMessage());
|
|
}
|
|
$this->success('查询结果',["list"=>$list,"count"=>$count]);
|
|
}
|
|
public function stores(){
|
|
$WAREHOUSEID = $this->auth->warehouseid;
|
|
$StoreModel = new \app\common\model\wms\Warestore;
|
|
$list = $StoreModel->with(['employees'])->where(["WAREHOUSEID"=>$WAREHOUSEID])->select();
|
|
$this->success("查询结果",$list);
|
|
}
|
|
public function qrcode(){
|
|
$params=$this->request->post();
|
|
$type = isset($params['type'])?$params['type']:'';
|
|
$lastCode = isset($params['lastCode'])?$params['lastCode']:'';
|
|
if($type){
|
|
$uuid = Random('uuid');
|
|
$this->success('查询结果',["list"=>$list,"count"=>$count]);
|
|
}else{
|
|
$this->error('未设置类型');
|
|
}
|
|
}
|
|
} |