|
@@ -686,36 +686,37 @@ class Purch extends Base
|
|
|
$uname = $this->uname;
|
|
|
|
|
|
foreach ($cgdNo as $vlue) {
|
|
|
- if ($status == 1 || $status == 2) {
|
|
|
-// $orderinfo = Db::name('sale')
|
|
|
-// ->alias('a')
|
|
|
-// ->field('a.id,a.orderCode,a.is_stock,a.order_type,a.cgderid')
|
|
|
-// ->leftJoin('order_num b','b.orderCode=a.orderCode')
|
|
|
-// ->where([
|
|
|
-// 'a.is_del'=>0,
|
|
|
-// 'b.cgdNo'=>$vlue,
|
|
|
-// ])->findOrEmpty();
|
|
|
- $is_stock = Db::name('good_basic')
|
|
|
- ->where(['is_del' => 0, 'spuCode' => $info[$vlue]['spuCode']])
|
|
|
- ->value('is_stock');
|
|
|
-
|
|
|
- if ($is_stock == 1) {
|
|
|
- //库存品,推给31库管人员、41库管-张凯旋
|
|
|
- $uids = Db::name('user_role')
|
|
|
- ->where([
|
|
|
- ['is_del', '=', 0],
|
|
|
- ['roleid', 'in', [31, 41]],
|
|
|
- ['status', '=', 1]
|
|
|
- ])->column('uid');
|
|
|
- if (!in_array($this->uid, $uids)) throw new Exception('库存品订单只能由库管人员操作');
|
|
|
- $process = ["order_code" => $vlue, "order_id" => isset($info[$vlue]['id']) ? $info[$vlue]['id'] : 0, "order_status" => $status, "order_type" => 'CGD', "before_status" => isset($info[$vlue]['status']) ? $info[$vlue]['status'] : 0, 'holder_id' => isset($supplier_cgderid[$info[$vlue]['supplierNo']]) ? $supplier_cgderid[$info[$vlue]['supplierNo']] : 0, 'handle_user_list' => implode(',', $uids)];
|
|
|
- } elseif ($is_stock == 0 || $info[$vlue]['order_type'] == 3) {
|
|
|
- //非库存品和采返商品,推给供应商负责人
|
|
|
- if ($this->uid != $supplier_cgderid[$info[$vlue]['supplierNo']]) throw new Exception('非库存品和采返商品只能由供应商负责人操作');
|
|
|
-
|
|
|
- $process = ["order_code" => $vlue, "order_id" => isset($info[$vlue]['id']) ? $info[$vlue]['id'] : 0, "order_status" => $status, "order_type" => 'CGD', "before_status" => isset($info[$vlue]['status']) ? $info[$vlue]['status'] : 0, 'holder_id' => isset($supplier_cgderid[$info[$vlue]['supplierNo']]) ? $supplier_cgderid[$info[$vlue]['supplierNo']] : 0, 'handle_user_list' => isset($supplier_cgderid[$info[$vlue]['supplierNo']]) ? $supplier_cgderid[$info[$vlue]['supplierNo']] : 0];
|
|
|
- }
|
|
|
- } else $process = ["order_code" => $vlue, "order_id" => isset($info[$vlue]['id']) ? $info[$vlue]['id'] : 0, "order_status" => $status, "order_type" => 'CGD', "before_status" => isset($info[$vlue]['status']) ? $info[$vlue]['status'] : 0, 'holder_id' => isset($supplier_cgderid[$info[$vlue]['supplierNo']]) ? $supplier_cgderid[$info[$vlue]['supplierNo']] : 0];
|
|
|
+// if ($status == 1 || $status == 2) {
|
|
|
+//// $orderinfo = Db::name('sale')
|
|
|
+//// ->alias('a')
|
|
|
+//// ->field('a.id,a.orderCode,a.is_stock,a.order_type,a.cgderid')
|
|
|
+//// ->leftJoin('order_num b','b.orderCode=a.orderCode')
|
|
|
+//// ->where([
|
|
|
+//// 'a.is_del'=>0,
|
|
|
+//// 'b.cgdNo'=>$vlue,
|
|
|
+//// ])->findOrEmpty();
|
|
|
+// $is_stock = Db::name('good_basic')
|
|
|
+// ->where(['is_del' => 0, 'spuCode' => $info[$vlue]['spuCode']])
|
|
|
+// ->value('is_stock');
|
|
|
+//
|
|
|
+// if ($is_stock == 1) {
|
|
|
+// //库存品,推给31库管人员、41库管-张凯旋
|
|
|
+// $uids = Db::name('user_role')
|
|
|
+// ->where([
|
|
|
+// ['is_del', '=', 0],
|
|
|
+// ['roleid', 'in', [31, 41]],
|
|
|
+// ['status', '=', 1]
|
|
|
+// ])->column('uid');
|
|
|
+// if (!in_array($this->uid, $uids)) throw new Exception('库存品订单只能由库管人员操作');
|
|
|
+// $process = ["order_code" => $vlue, "order_id" => isset($info[$vlue]['id']) ? $info[$vlue]['id'] : 0, "order_status" => $status, "order_type" => 'CGD', "before_status" => isset($info[$vlue]['status']) ? $info[$vlue]['status'] : 0, 'holder_id' => isset($supplier_cgderid[$info[$vlue]['supplierNo']]) ? $supplier_cgderid[$info[$vlue]['supplierNo']] : 0, 'handle_user_list' => implode(',', $uids)];
|
|
|
+// } elseif ($is_stock == 0 || $info[$vlue]['order_type'] == 3) {
|
|
|
+// //非库存品和采返商品,推给供应商负责人
|
|
|
+// if ($this->uid != $supplier_cgderid[$info[$vlue]['supplierNo']]) throw new Exception('非库存品和采返商品只能由供应商负责人操作');
|
|
|
+//
|
|
|
+// $process = ["order_code" => $vlue, "order_id" => isset($info[$vlue]['id']) ? $info[$vlue]['id'] : 0, "order_status" => $status, "order_type" => 'CGD', "before_status" => isset($info[$vlue]['status']) ? $info[$vlue]['status'] : 0, 'holder_id' => isset($supplier_cgderid[$info[$vlue]['supplierNo']]) ? $supplier_cgderid[$info[$vlue]['supplierNo']] : 0, 'handle_user_list' => isset($supplier_cgderid[$info[$vlue]['supplierNo']]) ? $supplier_cgderid[$info[$vlue]['supplierNo']] : 0];
|
|
|
+// }
|
|
|
+// } else
|
|
|
+ $process = ["order_code" => $vlue, "order_id" => isset($info[$vlue]['id']) ? $info[$vlue]['id'] : 0, "order_status" => $status, "order_type" => 'CGD', "before_status" => isset($info[$vlue]['status']) ? $info[$vlue]['status'] : 0, 'holder_id' => isset($supplier_cgderid[$info[$vlue]['supplierNo']]) ? $supplier_cgderid[$info[$vlue]['supplierNo']] : 0];
|
|
|
|
|
|
ProcessOrder::AddProcess(['id' => $uid, 'nickname' => $uname], $process);
|
|
|
$order = ["order_code" => $vlue, "status" => '', "action_remark" => $remark, "action_type" => "status"];
|