|
@@ -3,11 +3,11 @@ declare (strict_types = 1);
|
|
|
|
|
|
namespace app\admin\controller;
|
|
namespace app\admin\controller;
|
|
|
|
|
|
-use think\App;use think\facade\Validate;
|
|
|
|
|
|
+use app\admin\model\GoodChange;use think\App;use think\facade\Validate;
|
|
class Good extends Base
|
|
class Good extends Base
|
|
{
|
|
{
|
|
protected $model=null;
|
|
protected $model=null;
|
|
- protected $novalidate=["*"];
|
|
|
|
|
|
+// protected $novalidate=["*"];
|
|
public function __construct(App $app) {
|
|
public function __construct(App $app) {
|
|
parent::__construct($app);
|
|
parent::__construct($app);
|
|
$this->model=new \app\admin\model\Good();
|
|
$this->model=new \app\admin\model\Good();
|
|
@@ -18,8 +18,8 @@ class Good extends Base
|
|
*/
|
|
*/
|
|
public function list(){
|
|
public function list(){
|
|
$param=$this->request->param(["spuCode"=>"","status"=>"","good_name"=>"",'companyNo'=>'','supplierNo'=>'',
|
|
$param=$this->request->param(["spuCode"=>"","status"=>"","good_name"=>"",'companyNo'=>'','supplierNo'=>'',
|
|
- 'creater'=>'','isZx'=>'',"cat_diff"=>"","tax_diff"=>"","is_diff"=>"","start"=>"",'end'=>'','page'=>'1',
|
|
|
|
- 'size'=>'15'],"post","trim");
|
|
|
|
|
|
+ 'creater'=>'','isZx'=>'','isChange'=>'',"cat_diff"=>"","tax_diff"=>"","is_diff"=>"","start"=>"",'end'=>'',
|
|
|
|
+ 'page'=>'1','size'=>'15'],"post","trim");
|
|
$where=[];
|
|
$where=[];
|
|
$param["spuCode"]==""?: $where[]=['spuCode','like',"%{$param['spuCode']}%"];
|
|
$param["spuCode"]==""?: $where[]=['spuCode','like',"%{$param['spuCode']}%"];
|
|
$param["good_name"]==""?: $where[]=['good_name','like',"%{$param['good_name']}%"];
|
|
$param["good_name"]==""?: $where[]=['good_name','like',"%{$param['good_name']}%"];
|
|
@@ -28,6 +28,7 @@ class Good extends Base
|
|
$param["creater"]==""?: $where[]=['creater','like',"%{$param['creater']}%"];
|
|
$param["creater"]==""?: $where[]=['creater','like',"%{$param['creater']}%"];
|
|
$param["status"]===""?: $where[]=['status','=',$param['status']];
|
|
$param["status"]===""?: $where[]=['status','=',$param['status']];
|
|
$param["isZx"]==""?: $where[]=['isZx','=',$param['isZx']];
|
|
$param["isZx"]==""?: $where[]=['isZx','=',$param['isZx']];
|
|
|
|
+ $param["isChange"]===""?: $where[]=['isChange','=',$param['isChange']];
|
|
$param["is_diff"]==""?: $where[]=['cat_diff|tax_diff','=',2];
|
|
$param["is_diff"]==""?: $where[]=['cat_diff|tax_diff','=',2];
|
|
$param["cat_diff"]==""?: $where[]=['cat_diff','=',$param['cat_diff']];
|
|
$param["cat_diff"]==""?: $where[]=['cat_diff','=',$param['cat_diff']];
|
|
$param["tax_diff"]==""?: $where[]=['tax_diff','=',$param['tax_diff']];
|
|
$param["tax_diff"]==""?: $where[]=['tax_diff','=',$param['tax_diff']];
|
|
@@ -92,6 +93,11 @@ class Good extends Base
|
|
$temp['tax_diff']= $tax==$good->cgd_inv_tax?1:2;
|
|
$temp['tax_diff']= $tax==$good->cgd_inv_tax?1:2;
|
|
$temp['cat_diff']= $temp['inv_cat_code']==$good->cgd_inv_cat_code?1:2;
|
|
$temp['cat_diff']= $temp['inv_cat_code']==$good->cgd_inv_cat_code?1:2;
|
|
}
|
|
}
|
|
|
|
+ $check = $this->checkChange($good,$temp);
|
|
|
|
+ if(!empty($check)){
|
|
|
|
+ GoodChange::create($check);
|
|
|
|
+ $temp['isChange']=1;
|
|
|
|
+ }
|
|
$examinfo=$good->exam_info;
|
|
$examinfo=$good->exam_info;
|
|
$examinfo[]=['apply_name'=>$this->uname,'exam_status'=>$item['status'],"updatetime"=>date("Y-m-d H:i:s")];
|
|
$examinfo[]=['apply_name'=>$this->uname,'exam_status'=>$item['status'],"updatetime"=>date("Y-m-d H:i:s")];
|
|
$temp['exam_info'] = json_encode($examinfo,JSON_UNESCAPED_UNICODE);
|
|
$temp['exam_info'] = json_encode($examinfo,JSON_UNESCAPED_UNICODE);
|
|
@@ -134,4 +140,85 @@ class Good extends Base
|
|
'类目是否一致','税率是否一致','创建时间'];
|
|
'类目是否一致','税率是否一致','创建时间'];
|
|
excelExport("商品税率异常记录", $header, $list);
|
|
excelExport("商品税率异常记录", $header, $list);
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * @param $good
|
|
|
|
+ * @param $check
|
|
|
|
+ * @return array
|
|
|
|
+ */
|
|
|
|
+ private function checkChange($good,$check){
|
|
|
|
+ $temp=[];
|
|
|
|
+ if($check['status']==1){
|
|
|
|
+ $before=[];
|
|
|
|
+ $after=[];
|
|
|
|
+ if($good->cgd_inv_cat_code!=""&&$check['cgd_inv_cat_code']!=$good->cgd_inv_cat_code){
|
|
|
|
+ $before['inv_cat_code'] = $good->cgd_inv_cat_code;
|
|
|
|
+ $after['inv_cat_code'] = $check['cgd_inv_cat_code'];
|
|
|
|
+ }
|
|
|
|
+ if($good->cgd_inv_cat_name!=''&&$check['cgd_inv_cat_name']!=$good->cgd_inv_cat_name){
|
|
|
|
+ $before['inv_cat_name'] = $good->cgd_inv_cat_name;
|
|
|
|
+ $after['inv_cat_name'] = $check['cgd_inv_cat_name'];
|
|
|
|
+ }
|
|
|
|
+ if($good->cgd_inv_good_name!=''&&$check['cgd_inv_good_name']!=$good->cgd_inv_good_name){
|
|
|
|
+ $before['inv_good_name'] = $good->cgd_inv_good_name;
|
|
|
|
+ $after['inv_good_name'] = $check['cgd_inv_good_name'];
|
|
|
|
+ }
|
|
|
|
+ if($good->cgd_inv_tax!=''){
|
|
|
|
+ $cgd_inv_tax = bcdiv(str_replace('%', '', $good->cgd_inv_tax), '100', 2);
|
|
|
|
+ if($check['cgd_inv_tax']!=$cgd_inv_tax){
|
|
|
|
+ $before['inv_tax'] = $cgd_inv_tax;
|
|
|
|
+ $after['inv_tax'] = $check['cgd_inv_tax'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(!empty($before))$temp['before'] = json_encode($before,JSON_UNESCAPED_UNICODE);
|
|
|
|
+ if(!empty($after))$temp['after'] = json_encode($after,JSON_UNESCAPED_UNICODE);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if($check['status']==2){
|
|
|
|
+ $before=[];
|
|
|
|
+ $after=[];
|
|
|
|
+ if($good->inv_cat_code!=''&&$check['inv_cat_code']!=$good->inv_cat_code){
|
|
|
|
+ $before['inv_cat_code'] = $good->inv_cat_code;
|
|
|
|
+ $after['inv_cat_code'] = $check['inv_cat_code'];
|
|
|
|
+ }
|
|
|
|
+ if($good->inv_cat_name!=''&&$check['inv_cat_name']!=$good->inv_cat_name){
|
|
|
|
+ $before['inv_cat_name'] = $good->inv_cat_name;
|
|
|
|
+ $after['inv_cat_name'] = $check['inv_cat_name'];
|
|
|
|
+ }
|
|
|
|
+ if($good->inv_good_name!=''&&$check['inv_good_name']!=$good->inv_good_name){
|
|
|
|
+ $before['inv_good_name'] = $good->inv_good_name;
|
|
|
|
+ $after['inv_good_name'] = $check['inv_good_name'];
|
|
|
|
+ }
|
|
|
|
+ if($good->inv_tax!=''){
|
|
|
|
+ $inv_tax = bcdiv(str_replace('%', '', $good->inv_tax), '100', 2);
|
|
|
|
+ if($check['inv_tax']!=$inv_tax){
|
|
|
|
+ $before['inv_tax'] = $inv_tax;
|
|
|
|
+ $after['inv_tax'] = $check['inv_tax'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if($good->status==2&&$check['inv_tag']!=$good->inv_tag){
|
|
|
|
+ $before['inv_tag'] = $good->inv_tag;
|
|
|
|
+ $after['inv_tag'] = $check['inv_tag'];
|
|
|
|
+ }
|
|
|
|
+ if($good->status==2&&$check['is_discount']!=$good->is_discount){
|
|
|
|
+ $before['is_discount'] = $good->is_discount;
|
|
|
|
+ $after['is_discount'] = $check['is_discount'];
|
|
|
|
+ }
|
|
|
|
+ if($good->status==2&&$check['addTax']!=$good->addTax){
|
|
|
|
+ $before['addTax'] = $good->addTax;
|
|
|
|
+ $after['addTax'] = $check['addTax'];
|
|
|
|
+ }
|
|
|
|
+ if(!empty($before))$temp['before'] = json_encode($before,JSON_UNESCAPED_UNICODE);
|
|
|
|
+ if(!empty($after))$temp['after'] = json_encode($after,JSON_UNESCAPED_UNICODE);
|
|
|
|
+ }
|
|
|
|
+ if(!empty($temp)){
|
|
|
|
+ $temp['spuCode'] = $good->spuCode;
|
|
|
|
+ $temp['good_name'] = $good->good_name;
|
|
|
|
+ $temp['apply_id'] = $this->uid;
|
|
|
|
+ $temp['apply_name'] = $this->uname;
|
|
|
|
+ $temp['exam_status'] =$check['status'];
|
|
|
|
+ }
|
|
|
|
+ return $temp;
|
|
|
|
+ }
|
|
}
|
|
}
|