|
@@ -66,6 +66,7 @@ class OrderOutChild extends Base
|
|
|
'order_type' => '',
|
|
|
'relaComNo' => '',
|
|
|
'use_type' => '',
|
|
|
+ 'IsByMe' => '0',
|
|
|
], 'post', 'trim');
|
|
|
|
|
|
$where = [['a.is_del', '=', 0]];
|
|
@@ -88,32 +89,46 @@ class OrderOutChild extends Base
|
|
|
if ($param['relaComNo'] != '') $where[] = ['a.companyNo', '=', $param['relaComNo']];
|
|
|
if ($param['use_type'] !== '') $where[] = ['p.use_type', '=', $param['use_type']];
|
|
|
|
|
|
- $condition = '';
|
|
|
+ $condition = '1=1';
|
|
|
+ if($param['IsByMe']==1)$condition = '1=0';
|
|
|
//只有level2的账号过滤数据权限
|
|
|
if ($this->level == 2) {
|
|
|
-
|
|
|
//库管只能看到库存品订单,供应商负责人只能看到非库存品订单
|
|
|
-
|
|
|
//是否是仓库管理员
|
|
|
$tmp = Db::name('warehouse_info')->field('id')->where(['is_del' => 0, 'contactor' => $this->uid])->findOrEmpty();
|
|
|
|
|
|
//库管看到所有的库存品发货申请单
|
|
|
- if (!empty($tmp)) $condition .= " a.order_type=1 AND c.contactor=" . $this->uid;
|
|
|
+ if (!empty($tmp)) $condition .= " or (a.order_type=1 AND c.contactor=" . $this->uid.")";
|
|
|
else {
|
|
|
- $role = $this->checkDataShare();
|
|
|
- if (!empty($role[DataGroupModel::$type_全部])) {
|
|
|
- if ($condition != '') $condition .= " or ";
|
|
|
- $condition .= " a.apply_id in (" . implode(',', $role[DataGroupModel::$type_全部]) . ")";
|
|
|
- }
|
|
|
+ if($param['IsByMe']==0){
|
|
|
+ $role = $this->checkDataShare();
|
|
|
+ if (!empty($role[DataGroupModel::$type_全部])) {
|
|
|
+// if ($condition != '') $condition .= " or ";
|
|
|
+ $condition .= " or (a.apply_id in (" . implode(',', $role[DataGroupModel::$type_全部]) . "))";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
$person_supplier = Db::connect('mysql_sys')
|
|
|
->name('supplier')
|
|
|
->where(['is_del' => 0, 'personid' => $this->uid])
|
|
|
->column('code');
|
|
|
if ($person_supplier) {
|
|
|
- if ($condition != '') $condition .= " or ";
|
|
|
- $condition .= "(a.order_type<>1 and a.supplierNo in ('" . implode('\',\'', $person_supplier) . "'))";
|
|
|
+ if($param['IsByMe']==1){
|
|
|
+ $suppe = checkHasAccountBySupplierNos($person_supplier);
|
|
|
+ $suppAcco =array_diff($person_supplier,array_keys($suppe));
|
|
|
+ $person_supplier= $suppAcco;
|
|
|
+ }
|
|
|
+ $condition .= " or (a.order_type<>1 and a.supplierNo in ('" . implode('\',\'', $person_supplier) . "'))";
|
|
|
}
|
|
|
+ }
|
|
|
+ if ($this->level == 3 && $param['IsByMe']==1) {
|
|
|
+
|
|
|
+ //是否是仓库管理员
|
|
|
+ $tmp = Db::name('warehouse_info')->field('id')->where(['is_del' => 0, 'contactor' => $this->uid])->findOrEmpty();
|
|
|
+ //库管看到所有的库存品发货申请单
|
|
|
+ if (!empty($tmp)) $condition .= " or (a.order_type=1 AND c.contactor=" . $this->uid.")";
|
|
|
+
|
|
|
}
|
|
|
|
|
|
$count = Db::name('order_out_child')
|
|
@@ -176,6 +191,7 @@ class OrderOutChild extends Base
|
|
|
'order_type' => '',
|
|
|
'relaComNo' => '',
|
|
|
'use_type' => '',
|
|
|
+ 'IsByMe' => '0',
|
|
|
], 'post', 'trim');
|
|
|
|
|
|
$where = [['a.is_del', '=', 0]];
|
|
@@ -197,33 +213,46 @@ class OrderOutChild extends Base
|
|
|
if ($param['order_type'] != '') $where[] = ['a.order_type', '=', $param['order_type']];
|
|
|
if ($param['relaComNo'] != '') $where[] = ['a.companyNo', '=', $param['relaComNo']];
|
|
|
if ($param['use_type'] !== '') $where[] = ['p.use_type', '=', $param['use_type']];
|
|
|
-
|
|
|
- $condition = '';
|
|
|
+ $condition = '1=1';
|
|
|
+ if($param['IsByMe']==1)$condition = '1=0';
|
|
|
//只有level2的账号过滤数据权限
|
|
|
if ($this->level == 2) {
|
|
|
-
|
|
|
//库管只能看到库存品订单,供应商负责人只能看到非库存品订单
|
|
|
-
|
|
|
//是否是仓库管理员
|
|
|
$tmp = Db::name('warehouse_info')->field('id')->where(['is_del' => 0, 'contactor' => $this->uid])->findOrEmpty();
|
|
|
|
|
|
//库管看到所有的库存品发货申请单
|
|
|
- if (!empty($tmp)) $condition .= " a.order_type=1 AND c.contactor=" . $this->uid;
|
|
|
+ if (!empty($tmp)) $condition .= " or (a.order_type=1 AND c.contactor=" . $this->uid.")";
|
|
|
else {
|
|
|
- $role = $this->checkDataShare();
|
|
|
- if (!empty($role[DataGroupModel::$type_全部])) {
|
|
|
- if ($condition != '') $condition .= " or ";
|
|
|
- $condition .= " a.apply_id in (" . implode(',', $role[DataGroupModel::$type_全部]) . ")";
|
|
|
- }
|
|
|
+ if($param['IsByMe']==0){
|
|
|
+ $role = $this->checkDataShare();
|
|
|
+ if (!empty($role[DataGroupModel::$type_全部])) {
|
|
|
+// if ($condition != '') $condition .= " or ";
|
|
|
+ $condition .= " or (a.apply_id in (" . implode(',', $role[DataGroupModel::$type_全部]) . "))";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
$person_supplier = Db::connect('mysql_sys')
|
|
|
->name('supplier')
|
|
|
->where(['is_del' => 0, 'personid' => $this->uid])
|
|
|
->column('code');
|
|
|
if ($person_supplier) {
|
|
|
- if ($condition != '') $condition .= " or ";
|
|
|
- $condition .= "(a.order_type<>1 and a.supplierNo in ('" . implode('\',\'', $person_supplier) . "'))";
|
|
|
+ if($param['IsByMe']==1){
|
|
|
+ $suppe = checkHasAccountBySupplierNos($person_supplier);
|
|
|
+ $suppAcco =array_diff($person_supplier,array_keys($suppe));
|
|
|
+ $person_supplier= $suppAcco;
|
|
|
+ }
|
|
|
+ $condition .= " or (a.order_type<>1 and a.supplierNo in ('" . implode('\',\'', $person_supplier) . "'))";
|
|
|
}
|
|
|
+ }
|
|
|
+ if ($this->level == 3 && $param['IsByMe']==1) {
|
|
|
+
|
|
|
+ //是否是仓库管理员
|
|
|
+ $tmp = Db::name('warehouse_info')->field('id')->where(['is_del' => 0, 'contactor' => $this->uid])->findOrEmpty();
|
|
|
+ //库管看到所有的库存品发货申请单
|
|
|
+ if (!empty($tmp)) $condition .= " or (a.order_type=1 AND c.contactor=" . $this->uid.")";
|
|
|
+
|
|
|
}
|
|
|
|
|
|
$list = Db::name('order_out_child')
|