|
@@ -185,7 +185,7 @@ class ProductService extends Service
|
|
$model->product_category = $data['product_category'] ?? '';
|
|
$model->product_category = $data['product_category'] ?? '';
|
|
$model->title = $data['title'];
|
|
$model->title = $data['title'];
|
|
$model->code = $data['code'] ?? '';
|
|
$model->code = $data['code'] ?? '';
|
|
- $model->sn_code = $data['sn_code'] ?? '';
|
|
|
|
|
|
+ $model->warranty_time = $data['warranty_time'] ?? 0;
|
|
$model->size = $data['size'] ?? '';
|
|
$model->size = $data['size'] ?? '';
|
|
$model->unit = $data['unit'] ?? 0;
|
|
$model->unit = $data['unit'] ?? 0;
|
|
$model->bar_code = $data['bar_code'] ?? '';
|
|
$model->bar_code = $data['bar_code'] ?? '';
|
|
@@ -283,7 +283,7 @@ class ProductService extends Service
|
|
$model->product_category = $data['product_category'] ?? '';
|
|
$model->product_category = $data['product_category'] ?? '';
|
|
$model->title = $data['title'];
|
|
$model->title = $data['title'];
|
|
$model->code = $data['code'] ?? '';
|
|
$model->code = $data['code'] ?? '';
|
|
- $model->sn_code = $data['sn_code'] ?? '';
|
|
|
|
|
|
+ $model->warranty_time = $data['warranty_time'] ?? 0;
|
|
$model->size = $data['size'] ?? '';
|
|
$model->size = $data['size'] ?? '';
|
|
$model->unit = $data['unit'] ?? 0;
|
|
$model->unit = $data['unit'] ?? 0;
|
|
$model->bar_code = $data['bar_code'] ?? '';
|
|
$model->bar_code = $data['bar_code'] ?? '';
|
|
@@ -506,7 +506,7 @@ class ProductService extends Service
|
|
public function productList($data,$user){
|
|
public function productList($data,$user){
|
|
$model = Product::ProductClear($user,$data);
|
|
$model = Product::ProductClear($user,$data);
|
|
$model = $model->where('del_time',0)
|
|
$model = $model->where('del_time',0)
|
|
- ->select('title','id','product_category_id','code','size','unit','bar_code','retail_price','cost','state','crt_id','crt_time','mark','depart_id','top_depart_id','sn_code')
|
|
|
|
|
|
+ ->select('title','id','product_category_id','code','size','unit','bar_code','retail_price','cost','state','crt_id','crt_time','mark','depart_id','top_depart_id')
|
|
->orderby('id', 'desc');
|
|
->orderby('id', 'desc');
|
|
|
|
|
|
if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
|
|
if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
|
|
@@ -530,7 +530,7 @@ class ProductService extends Service
|
|
if(! empty($list)) {
|
|
if(! empty($list)) {
|
|
$productList = Product::where('del_time',0)
|
|
$productList = Product::where('del_time',0)
|
|
->whereIn('product_category_id',array_column($list,'id'))
|
|
->whereIn('product_category_id',array_column($list,'id'))
|
|
- ->select('id','product_category_id','title','code','sn_code')
|
|
|
|
|
|
+ ->select('id','product_category_id','title','code')
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
$productMap = [];
|
|
$productMap = [];
|
|
foreach ($productList as $value){
|
|
foreach ($productList as $value){
|
|
@@ -557,7 +557,6 @@ class ProductService extends Service
|
|
if(empty($data['title'])) return [false,'产品名称不能为空'];
|
|
if(empty($data['title'])) return [false,'产品名称不能为空'];
|
|
if(empty($data['product_category_id'])) return [false,'产品分类不能为空'];
|
|
if(empty($data['product_category_id'])) return [false,'产品分类不能为空'];
|
|
if(empty($data['code'])) return [false,'产品编码不能为空'];
|
|
if(empty($data['code'])) return [false,'产品编码不能为空'];
|
|
- if(empty($data['sn_code'])) return [false,'产品SN编码不能为空'];
|
|
|
|
if(empty($data['cost'])) return [false,'成本不能为空'];
|
|
if(empty($data['cost'])) return [false,'成本不能为空'];
|
|
$res = $this->checkNumber($data['cost']);
|
|
$res = $this->checkNumber($data['cost']);
|
|
if(! $res) return [false,'成本请输入不超过两位小数并且大于0的数值'];
|
|
if(! $res) return [false,'成本请输入不超过两位小数并且大于0的数值'];
|
|
@@ -588,17 +587,17 @@ class ProductService extends Service
|
|
$top_depart_id = $user['head'] ?? [];
|
|
$top_depart_id = $user['head'] ?? [];
|
|
$top_depart_id = $top_depart_id['id'] ?? 0;
|
|
$top_depart_id = $top_depart_id['id'] ?? 0;
|
|
if($is_add){
|
|
if($is_add){
|
|
- $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}' OR sn_code = '{$data['sn_code']}') AND (top_depart_id = {$data['top_depart_id']} OR top_depart_id = {$top_depart_id})")
|
|
|
|
|
|
+ $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}') AND (top_depart_id = {$data['top_depart_id']} OR top_depart_id = {$top_depart_id})")
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
->exists();
|
|
->exists();
|
|
}else{
|
|
}else{
|
|
if(empty($data['id'])) return [false,'ID不能为空'];
|
|
if(empty($data['id'])) return [false,'ID不能为空'];
|
|
- $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}' OR sn_code = '{$data['sn_code']}') AND (top_depart_id = {$data['top_depart_id']} OR top_depart_id = {$top_depart_id})")
|
|
|
|
|
|
+ $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}') AND (top_depart_id = {$data['top_depart_id']} OR top_depart_id = {$top_depart_id})")
|
|
->where('id','<>',$data['id'])
|
|
->where('id','<>',$data['id'])
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
->exists();
|
|
->exists();
|
|
}
|
|
}
|
|
- if($bool) return [false,'产品名称、编码与SN编码不能重复'];
|
|
|
|
|
|
+ if($bool) return [false,'产品名称、编码不能重复'];
|
|
|
|
|
|
return [true, $data];
|
|
return [true, $data];
|
|
}
|
|
}
|