|
@@ -168,100 +168,104 @@ public function __construct(App $app)
|
|
|
|
|
|
return app_show(0, "获取成功", ["list" => $data, "count" => $count]);
|
|
|
}
|
|
|
-public function list()
|
|
|
-{
|
|
|
- $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
|
|
|
- $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
|
|
|
- $where = [['a.is_del',"=",0],['b.is_del',"=",0]];
|
|
|
- $start= isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start']:"";
|
|
|
- if ($start !="") {
|
|
|
- // $where["a.addtime"]=Db::raw(">= '{$start}'");
|
|
|
- $where[]=['a.addtime',">=",$start];
|
|
|
- }
|
|
|
- $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
|
|
|
- if($end !=""){
|
|
|
- // $where["a.addtime"] = Db::raw("<= '{$end}'");
|
|
|
- $where[]=['a.addtime',"<=",$end];
|
|
|
- }
|
|
|
- $check_code = isset($this->post['check_code']) && $this->post['check_code'] !== "" ? trim($this->post['check_code']) : "";
|
|
|
- if ($check_code !== "") {
|
|
|
- // $where['a.check_code'] = Db::raw("like '%$check_code%'");
|
|
|
- $where[]=['a.check_code',"like","%$check_code%"];
|
|
|
- }
|
|
|
- $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code'] !== "" ? trim($this->post['wsm_code']) : "";
|
|
|
- if ($wsm_code !== "") {
|
|
|
- // $where['a.wsm_code'] = Db::raw("like '%$wsm_code%'");
|
|
|
- $where[]=['a.wsm_code',"like","%$wsm_code%"];
|
|
|
- }
|
|
|
- $apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] !== "" ? trim($this->post['apply_name']) : "";
|
|
|
- if ($apply_name !== "") {
|
|
|
- // $where['a.apply_name'] = $apply_name;
|
|
|
- $where[]=['a.apply_name',"like","%$apply_name%"];
|
|
|
- }
|
|
|
- $type = isset($this->post['type']) && $this->post['type'] !== "" ? trim($this->post['type']) : "";
|
|
|
- if ($type !== "") {
|
|
|
- // $where['a.type'] = $type;
|
|
|
- $where[]=['a.type',"=",$type];
|
|
|
- }
|
|
|
- $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !== "" ? intval($this->post['apply_id']) : "";
|
|
|
- if ($apply_id!== "") {
|
|
|
- // $where['a.apply_id'] = $apply_id;
|
|
|
- $where[]=['a.apply_id',"=",$apply_id];
|
|
|
- }
|
|
|
- $status= isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
|
|
|
- if ($status !== "") {
|
|
|
- // $where['a.status '] = $status;
|
|
|
- $where[]=['a.status',"=",$status];
|
|
|
- }
|
|
|
- $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !== "" ? trim($this->post['companyNo']) : "";
|
|
|
- if ($companyNo !== "") {
|
|
|
- $condition[]=["a.companyNo ","=",$companyNo ];
|
|
|
- }
|
|
|
+
|
|
|
+ public function list()
|
|
|
+ {
|
|
|
+ $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
|
|
|
+ $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
|
|
|
+ $where = [['a.is_del', "=", 0], ['b.is_del', "=", 0]];
|
|
|
+ $start = isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start'] : "";
|
|
|
+ if ($start != "") {
|
|
|
+ // $where["a.addtime"]=Db::raw(">= '{$start}'");
|
|
|
+ $where[] = ['a.addtime', ">=", $start];
|
|
|
+ }
|
|
|
+ $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] : "";
|
|
|
+ if ($end != "") {
|
|
|
+ // $where["a.addtime"] = Db::raw("<= '{$end}'");
|
|
|
+ $where[] = ['a.addtime', "<=", $end];
|
|
|
+ }
|
|
|
+ $check_code = isset($this->post['check_code']) && $this->post['check_code'] !== "" ? trim($this->post['check_code']) : "";
|
|
|
+ if ($check_code !== "") {
|
|
|
+ // $where['a.check_code'] = Db::raw("like '%$check_code%'");
|
|
|
+ $where[] = ['a.check_code', "like", "%$check_code%"];
|
|
|
+ }
|
|
|
+ $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code'] !== "" ? trim($this->post['wsm_code']) : "";
|
|
|
+ if ($wsm_code !== "") {
|
|
|
+ // $where['a.wsm_code'] = Db::raw("like '%$wsm_code%'");
|
|
|
+ $where[] = ['a.wsm_code', "like", "%$wsm_code%"];
|
|
|
+ }
|
|
|
+ $apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] !== "" ? trim($this->post['apply_name']) : "";
|
|
|
+ if ($apply_name !== "") {
|
|
|
+ // $where['a.apply_name'] = $apply_name;
|
|
|
+ $where[] = ['a.apply_name', "like", "%$apply_name%"];
|
|
|
+ }
|
|
|
+ $type = isset($this->post['type']) && $this->post['type'] !== "" ? trim($this->post['type']) : "";
|
|
|
+ if ($type !== "") {
|
|
|
+ // $where['a.type'] = $type;
|
|
|
+ $where[] = ['a.type', "=", $type];
|
|
|
+ }
|
|
|
+ $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !== "" ? intval($this->post['apply_id']) : "";
|
|
|
+ if ($apply_id !== "") {
|
|
|
+ // $where['a.apply_id'] = $apply_id;
|
|
|
+ $where[] = ['a.apply_id', "=", $apply_id];
|
|
|
+ }
|
|
|
+ $status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "";
|
|
|
+ if ($status !== "") {
|
|
|
+ // $where['a.status '] = $status;
|
|
|
+ $where[] = ['a.status', "=", $status];
|
|
|
+ }
|
|
|
+ $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !== "" ? trim($this->post['companyNo']) : "";
|
|
|
+ if ($companyNo !== "") {
|
|
|
+ $condition[] = ["a.companyNo ", "=", $companyNo];
|
|
|
+ }
|
|
|
|
|
|
// $role = $this->checkDataShare();
|
|
|
// if (!empty($role[DataGroupModel::$type_全部])) $where[] = ['a.apply_id', 'in', $role[DataGroupModel::$type_全部]];
|
|
|
$role = $this->checkDataShare();
|
|
|
- $hand = resign_hand_user($this->uid,0);
|
|
|
+ $hand = resign_hand_user($this->uid, 0);
|
|
|
if (!empty($role[DataGroupModel::$type_全部])) {
|
|
|
- $arr= array_unique(array_merge($hand,$role[DataGroupModel::$type_全部]));
|
|
|
- $where[] = ['a.apply_id', 'in',$arr];
|
|
|
+ $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部]));
|
|
|
+ $where[] = ['a.apply_id', 'in', $arr];
|
|
|
}
|
|
|
|
|
|
- $count = Db::name('good_check')
|
|
|
- ->alias('a')
|
|
|
- ->join("warehouse_info b","a.wsm_code = b.wsm_code","left")
|
|
|
- ->join("supplier v","v.code=b.supplierNo","left")
|
|
|
- ->where($where)
|
|
|
- ->count();
|
|
|
- $total = ceil($count / $size);
|
|
|
- $page = $page <= $total ? $page : $total;
|
|
|
- $list = Db::name('good_check')
|
|
|
- ->alias('a')
|
|
|
- ->join("warehouse_info b","a.wsm_code = b.wsm_code","left")
|
|
|
- ->join("supplier v","v.code=b.supplierNo","left")
|
|
|
- ->field("a.status,a.apply_id,a.apply_name,a.type,a.addtime,a.wsm_code,a.check_code,b.name,a.id,v.name as 'caname',v.code")
|
|
|
- ->where($where)
|
|
|
- ->page($page,$size)
|
|
|
- ->order("a.id desc")
|
|
|
- ->select()
|
|
|
- ->toArray();
|
|
|
- $data=[];
|
|
|
- foreach ($list as $key=>$value){
|
|
|
- $value['rename'] ='';
|
|
|
- if($value['apply_id']!=0){
|
|
|
- $depart = Db::name("depart_user")->alias("a")->leftJoin("company_item b","a.itemid = b.id")->where(['a.uid'=>$value['apply_id'],'a.is_del'=>0])
|
|
|
- ->column('b.name');
|
|
|
- // var_dump(Db::name("depart_user")->getLastSql());
|
|
|
- $value['rename'] =implode(",",$depart);
|
|
|
- }
|
|
|
- //是否具有编辑权限
|
|
|
- $value['is_allow_update'] = 0;
|
|
|
- if (in_array($this->roleid, [1, 33]) || in_array($value['apply_id'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1;
|
|
|
- $data[] = $value;
|
|
|
- }
|
|
|
- return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
|
|
|
+ $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo']!="" ? trim($this->post['relaComNo']):"";
|
|
|
+ if($relaComNo!="") $where[]=['a.companyNo','=', $relaComNo];
|
|
|
|
|
|
- }
|
|
|
+ $count = Db::name('good_check')
|
|
|
+ ->alias('a')
|
|
|
+ ->join("warehouse_info b", "a.wsm_code = b.wsm_code", "left")
|
|
|
+ ->join("supplier v", "v.code=b.supplierNo", "left")
|
|
|
+ ->where($where)
|
|
|
+ ->count();
|
|
|
+ $total = ceil($count / $size);
|
|
|
+ $page = $page <= $total ? $page : $total;
|
|
|
+ $list = Db::name('good_check')
|
|
|
+ ->alias('a')
|
|
|
+ ->join("warehouse_info b", "a.wsm_code = b.wsm_code", "left")
|
|
|
+ ->join("supplier v", "v.code=b.supplierNo", "left")
|
|
|
+ ->field("a.status,a.apply_id,a.apply_name,a.type,a.addtime,a.wsm_code,a.check_code,b.name,a.id,v.name as 'caname',v.code")
|
|
|
+ ->where($where)
|
|
|
+ ->page($page, $size)
|
|
|
+ ->order("a.id desc")
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+ $data = [];
|
|
|
+ foreach ($list as $key => $value) {
|
|
|
+ $value['rename'] = '';
|
|
|
+ if ($value['apply_id'] != 0) {
|
|
|
+ $depart = Db::name("depart_user")->alias("a")->leftJoin("company_item b", "a.itemid = b.id")->where(['a.uid' => $value['apply_id'], 'a.is_del' => 0])
|
|
|
+ ->column('b.name');
|
|
|
+ // var_dump(Db::name("depart_user")->getLastSql());
|
|
|
+ $value['rename'] = implode(",", $depart);
|
|
|
+ }
|
|
|
+ //是否具有编辑权限
|
|
|
+ $value['is_allow_update'] = 0;
|
|
|
+ if (in_array($this->roleid, [1, 33]) || in_array($value['apply_id'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1;
|
|
|
+ $data[] = $value;
|
|
|
+ }
|
|
|
+ return app_show(0, "获取成功", ['count' => $count, 'list' => $data]);
|
|
|
+
|
|
|
+ }
|
|
|
public function goodlist(){
|
|
|
$page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']) :"1";
|
|
|
$size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']) :"10";
|