|
@@ -34,7 +34,7 @@ class ApproveInfoService
|
|
|
* @param mixed $user 用户信息
|
|
|
* @param string $way 方式:create=申请,update=重新发起
|
|
|
**/
|
|
|
- public static function create($id, $module, $params, $user,$way)
|
|
|
+ public static function create($id, $module, $params, $user, $way)
|
|
|
{
|
|
|
$userid = $user['userid'];
|
|
|
$apply_user_id = $userid;
|
|
@@ -145,14 +145,15 @@ class ApproveInfoService
|
|
|
}
|
|
|
Db::commit();
|
|
|
} catch (Exception $e) {
|
|
|
- except('出现错误:' . $e->getMessage());
|
|
|
+ Db::rollback();
|
|
|
+ except('出现错误:' . $e->getMessage() . '|' . $e->getFile() . '|' . $e->getLine());
|
|
|
}
|
|
|
|
|
|
- if($way == CommonConstant::create){
|
|
|
+ if ($way == CommonConstant::create) {
|
|
|
if ($module == CommonConstant::MODULE_9) {
|
|
|
// 生成合同编号
|
|
|
$contract_no = CommonService::get_contract_no($params['type']);
|
|
|
- $info->save(['reason'=>$contract_no]);
|
|
|
+ $info->save(['reason' => $contract_no]);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -368,9 +369,8 @@ class ApproveInfoService
|
|
|
->with([
|
|
|
'goodsStock',
|
|
|
])
|
|
|
- ->select()
|
|
|
- ->toArray();
|
|
|
- $goods_object = $goods_list ? array_column($goods_list, null, 'id') : [];
|
|
|
+ ->select();
|
|
|
+ $goods_object = $goods_list ? array_column($goods_list->toArray(), null, 'id') : [];
|
|
|
$goods_name = '';
|
|
|
$goods_stock_name = '';
|
|
|
$apply_goods_data = [];
|
|
@@ -433,7 +433,7 @@ class ApproveInfoService
|
|
|
|
|
|
// 批量导入
|
|
|
if ($category_first_data) {
|
|
|
- $category_first_list = GoodsCategoryService::get_list([['name', 'in', array_keys($category_first_data)]],1);
|
|
|
+ $category_first_list = GoodsCategoryService::get_list([['name', 'in', array_keys($category_first_data)]], 1);
|
|
|
$category_first_object = $category_first_list ? array_column($category_first_list->toArray(), null, 'name') : [];
|
|
|
foreach ($category_first_data as $key => $value) {
|
|
|
if (array_key_exists($key, $category_first_object)) {
|
|
@@ -493,10 +493,11 @@ class ApproveInfoService
|
|
|
if ($value['flag'] == '2') {
|
|
|
// 批量导入
|
|
|
if (array_key_exists($value['goods_category_first'], $category_object)) {
|
|
|
- $category_info = $category_object[$value['goods_category_first']];
|
|
|
- $goods_category_first_id = $category_info['id'];
|
|
|
- $category_info_object = array_column($category_info['childlist'], null, 'name');
|
|
|
- $goods_category_id = $category_info_object[$value['goods_category_id']];
|
|
|
+ $category_first_info = $category_object[$value['goods_category_first']];
|
|
|
+ $goods_category_first_id = $category_first_info['id'];
|
|
|
+ $category_second_object = array_column($category_first_info['childlist'], null, 'name');
|
|
|
+ $category_second_info = $category_second_object[$value['goods_category_id']];
|
|
|
+ $goods_category_id = $category_second_info['id'];
|
|
|
|
|
|
$goods_ids_new[$key] = $value;
|
|
|
$goods_ids_new[$key]['goods_category_first'] = $goods_category_first_id;
|