|
@@ -22,6 +22,7 @@ class Resign extends Base
|
|
|
parent::__construct($app);
|
|
|
}
|
|
|
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 =[['p.is_del',"=",0]];
|
|
@@ -74,13 +75,16 @@ class Resign extends Base
|
|
|
$where[]=['p.addtime',"<=",$end];
|
|
|
}
|
|
|
// $role=$this->checkRole();
|
|
|
- $condition='';
|
|
|
+// $condition='';
|
|
|
// if(!empty($role['write']) && $this->uid!=""){
|
|
|
// // $where[]=["a.apply_id","in",$role['write']];
|
|
|
// $condition .="p.cgderid = {$this->uid} or p.apply_id in (".implode(',',$role['write']).")";
|
|
|
// }
|
|
|
- $role = $this->checkDataShare();
|
|
|
- if (!empty($role[DataGroupModel::$type_全部])) $condition .="p.cgderid = {$this->uid} or p.apply_id in (".implode(',',$role[DataGroupModel::$type_全部]).")";
|
|
|
+// $role = $this->checkDataShare();
|
|
|
+// if (!empty($role[DataGroupModel::$type_全部])) $condition .="p.cgderid = {$this->uid} or p.apply_id in (".implode(',',$role[DataGroupModel::$type_全部]).")";
|
|
|
+ //超管、库管、库管-张凯旋、boss能看到所有,其他人只能看到自己身为采购员的单子
|
|
|
+ $super_roleid = array_merge([1, 33], config('app.wsm_cgder_role'));
|
|
|
+ if (!in_array($this->roleid, $super_roleid)) $where[] = ['cgderid', '=', $this->uid];
|
|
|
|
|
|
$company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
|
|
|
if ($company_name !== "") $where[] = ["p.apply_id", 'in', get_company_item_user_by_name($company_name)];
|
|
@@ -92,7 +96,7 @@ class Resign extends Base
|
|
|
->alias('p')
|
|
|
->leftJoin("depart_user u", "u.uid=p.apply_id AND u.is_del=0")
|
|
|
->where($where)
|
|
|
- ->where($condition)
|
|
|
+// ->where($condition)
|
|
|
->count();
|
|
|
$total = ceil($count/$size);
|
|
|
$page = $page >= $total ? $total : $page;
|
|
@@ -101,7 +105,7 @@ class Resign extends Base
|
|
|
->field('p.*,u.itemid')
|
|
|
->leftJoin("depart_user u", "u.uid=p.apply_id AND u.is_del=0")
|
|
|
->where($where)
|
|
|
- ->where($condition)
|
|
|
+// ->where($condition)
|
|
|
->page($page,$size)
|
|
|
->order("p.addtime desc")
|
|
|
->cursor();
|
|
@@ -125,12 +129,12 @@ class Resign extends Base
|
|
|
$value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
|
|
|
|
|
|
//是否具有编辑权限
|
|
|
- $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;
|
|
|
+// $value['is_allow_update'] = 0;
|
|
|
+// if (in_array($this->roleid, $super_roleid) || in_array($value['apply_id'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1;
|
|
|
|
|
|
$data[]=$value;
|
|
|
}
|
|
|
- return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);
|
|
|
+ return app_show(0,"获取成功",["count"=>$count,"list"=>$data]);
|
|
|
}
|
|
|
|
|
|
public function add(){
|
|
@@ -217,7 +221,15 @@ class Resign extends Base
|
|
|
];
|
|
|
$in = Db::name("purchease")->insert($info,true);
|
|
|
if($in>0){
|
|
|
- $order = ["order_type" => 'BHD', "order_code" => $bk_code, "order_id" => $in, "order_status" => 1, "before_status" => 1, 'wait_id' => $supplier['personid'], 'wait_name' => $supplier['person']];
|
|
|
+ //备库单,推给供应商负责人、库管、库管-张凯旋
|
|
|
+ $handle_user_list = Db::name('user_role')
|
|
|
+ ->where('is_del', 0)
|
|
|
+ ->whereIn('roleid', config('app.wsm_cgder_role'))
|
|
|
+ ->where('status',1)
|
|
|
+ ->column('uid');
|
|
|
+ $handle_user_list[]=$supplier['personid'];
|
|
|
+
|
|
|
+ $order = ["order_type" => 'BHD', "order_code" => $bk_code, "order_id" => $in, "order_status" => 1, "before_status" => 1, 'handle_user_list'=>implode(',',$handle_user_list)];
|
|
|
ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $order);
|
|
|
$ste = ["order_code" => $bk_code, "status" => 0, "action_remark" => '', "action_type" => "create"];
|
|
|
ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], $ste, "BHD", 1, $info);
|