|
@@ -81,14 +81,18 @@ class Purchin extends Base
|
|
|
$where[]=['a.wsm_code',"in",$wsmcode];
|
|
|
}
|
|
|
$role=$this->checkRole();
|
|
|
- if(!empty($role['write'])){
|
|
|
- $where[]=["apply_id","in",$role['write']];
|
|
|
+ $condition="";
|
|
|
+ if(!empty($role['write'])|| $this->uid!=''){
|
|
|
+// $condition.=["apply_id","in",$role['write']];
|
|
|
+ $condition.="a.apply_id in (".implode(",",$role['write']).") or c.contactor = {$this->uid}";
|
|
|
}
|
|
|
$count = Db::name('purchease_in')->alias('a')->join("purchease_order b","b.cgdNo=a.cgdNo","left")
|
|
|
- ->where($where)->count();
|
|
|
+ ->leftJoin("warehouse_info c","a.wsm_code=c.wsm_code")
|
|
|
+ ->where($where)->where($condition)->count();
|
|
|
$total = ceil($count/$size);
|
|
|
$page = $page >= $total ? $total : $page;
|
|
|
$list = Db::name('purchease_in')->alias('a')->join("purchease_order b","b.cgdNo=a.cgdNo","left")
|
|
|
+ ->leftJoin("warehouse_info c","a.wsm_code=c.wsm_code")
|
|
|
->where($where)->page($page,$size)
|
|
|
->field("a.apply_name,a.sendtime,b.order_type,a.status,a.cgdNo,a.wsm_in_code,a.send_num,a.wsm_code,b.good_name,b.spuCode,
|
|
|
a.post_company,a.post_code,a.post_fee,a.apply_id,a.wsm_num,a.error_num,a.wait_num,a.status,a.check_name,a.checkid,b.bkcode,b.supplierNo")
|