Commit 49541a37 by 杨树贤

共用申请部分逻辑修改

parent bcd14c91
......@@ -32,6 +32,7 @@ class SupplierShareApplyApiController extends Controller
* 如果该供应商没有sku采购员,有其他采购员,则显示其他采购员对应的采购部门(有几个部门就显示几个部门,不显示运营部)
* 如果该供应商没有sku采购员,也没有采购员,有运营部人员,则显示运营部;
* PS:该供应商完全没有人员,则无法申请共用(同现有流程)
* 如果被申请的供应商类型为待转正,校验后的提示改为:该供应商为待转正的历史数据,无法申请共用,请联系采购总监直接分配采购员
**/
public function CheckApplySupplierShare($request)
{
......@@ -40,14 +41,15 @@ class SupplierShareApplyApiController extends Controller
$this->response(-1, '供应商名称不能为空');
}
$supplierModel = new SupplierChannelModel();
//下面的处理是为了兼容有问题的数据
if (!empty($supplier = $supplierModel->where('supplier_name', $supplierName)->where('group_code', '!=', '')->first())) {
// $supplier = $supplierModel->where('supplier_name', 'like', "%$supplierName%")->whereNotIn('status',
// [SupplierChannelModel::STATUS_DISABLE, SupplierChannelModel::STATUS_REJECT])->first();
}
$supplier = $supplierModel->where('supplier_name', $supplierName)->first();
if (empty($supplier)) {
$this->response(-1, '该供应商名称不存在,请输入正确供应商名称');
}
if ($supplier['is_type'] == 1) {
$this->response(-1, '该供应商为待转正的历史数据,无法申请共用,请联系采购总监直接分配采购员');
}
$hasYunxinChannelUid = $supplier['yunxin_channel_uid'] ? 1 : 0;
$userId = $request->user->userId;
$codeId = $request->user->codeId;
......@@ -143,5 +145,4 @@ class SupplierShareApplyApiController extends Controller
}
return $this->response(0, '审核操作成功');
}
}
......@@ -177,9 +177,12 @@ class SupplierShareApplyService
$supplierService->autoChangeIsType($supplier);
//最后同步到erp
$syncService = new SyncSupplierService();
$syncService->syncSupplierToErp($apply['supplier_id']);
//如果供应商有集团编码,那么就同步到erp
if (!empty($supplier['group_code'])) {
$syncService->syncSupplierToErp($apply['supplier_id']);
}
}
}
return $applyModel->where('id', $id)->update($apply);
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment