|
@@ -71,13 +71,15 @@ class Resign extends Base
|
|
|
$where[]=['addtime',"<=",$end];
|
|
|
}
|
|
|
$role=$this->checkRole();
|
|
|
- if(!empty($role['write'])){
|
|
|
- $where[]=["apply_id","in",$role['write']];
|
|
|
+ $condition='';
|
|
|
+ if(!empty($role['write']) && $this->uid!=""){
|
|
|
+ // $where[]=["a.apply_id","in",$role['write']];
|
|
|
+ $condition .="cgderid = {$this->uid} or apply_id in (".implode(',',$role['write']).")";
|
|
|
}
|
|
|
- $count=Db::name("purchease")->where($where)->count();
|
|
|
+ $count=Db::name("purchease")->where($where)->where($condition)->count();
|
|
|
$total = ceil($count/$size);
|
|
|
$page = $page >= $total ? $total : $page;
|
|
|
- $list = Db::name("purchease")->where($where)->page($page,$size)->order("addtime desc")->select();
|
|
|
+ $list = Db::name("purchease")->where($where)->where($condition)->page($page,$size)->order("addtime desc")->select();
|
|
|
$data=[];
|
|
|
foreach ($list as $value){
|
|
|
$value['wsm_name']="";
|
|
@@ -105,14 +107,6 @@ class Resign extends Base
|
|
|
if($token==""){
|
|
|
return error_show(101,'token不能为空');
|
|
|
}
|
|
|
-// $customer = isset($this->post['customer_code'])&&$this->post['customer_code']!="" ?trim($this->post['customer_code']):"";
|
|
|
-// if($customer==""){
|
|
|
-// return error_show(1004,"参数customer_code不能为空");
|
|
|
-// }
|
|
|
-// $supplier = isset($this->post['supplier_code'])&&$this->post['supplier_code']!="" ?trim($this->post['supplier_code']):"";
|
|
|
-// if($supplier==""){
|
|
|
-// return error_show(1004,"参数supplier_code不能为空");
|
|
|
-// }
|
|
|
$good_code = isset($this->post['good_code']) && $this->post['good_code']!=""?trim($this->post['good_code']):"";
|
|
|
if($good_code==""){
|
|
|
return error_show(1004,"参数good_code不能为空");
|
|
@@ -134,6 +128,9 @@ class Resign extends Base
|
|
|
if($good==false){
|
|
|
return error_show(1004,"未找到商品数据");
|
|
|
}
|
|
|
+ $supplier=Db::name("supplier")->where("code","=",$good['supplierNo'])->find();
|
|
|
+ if($supplier==false) return error_show(1004,"未找到供应商数据");
|
|
|
+
|
|
|
//查验仓库库存数量
|
|
|
$stock =Db::name("good_stock")->alias("a")->leftJoin("warehouse_info b","a.wsm_code=b.wsm_code")->where
|
|
|
(["spuCode"=>$good_code, "a.is_del"=>0,"a.status"=>1,"b.companyNo"=>$good['companyNo']])->field("a.id,a.usable_stock,a.wait_out_stock")->find();
|
|
@@ -172,6 +169,8 @@ class Resign extends Base
|
|
|
"lasttime"=>$lastime,
|
|
|
"status"=>1,
|
|
|
"remark"=>$mark,
|
|
|
+ "cgder"=>$supplier['person'],
|
|
|
+ "cgderid"=>$supplier['personid'],
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s"),
|
|
|
"apply_id"=>$userinfo['id'],
|
|
@@ -493,7 +492,7 @@ class Resign extends Base
|
|
|
try{
|
|
|
$in = Db::name('purchease_feedback')->insert($data,true);
|
|
|
if($in>0){
|
|
|
- $order=["order_type"=>'FKD',"order_code"=>$info['bk_code'],"order_id"=>$in, "order_status"=>0];
|
|
|
+ $order=["order_type"=>'FKD',"order_code"=>$info['bk_code'],"order_id"=>$in, "order_status"=>0,"before_status"=>1];
|
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
$ste = ["order_code"=>$info['bk_code'],"status"=>0,"action_remark"=>'',"action_type"=>"create"];
|
|
|
ActionLog::logAdd($this->post['token'],$ste,"FKD",0,$data);
|
|
@@ -595,7 +594,8 @@ class Resign extends Base
|
|
|
$feed['updatetime']=date("Y-m-d H:i:s");
|
|
|
$up = Db::name("purchease")->update($feed);
|
|
|
if($up){
|
|
|
- $order=["order_type"=>'BHD',"order_code"=>$feed['bk_code'],"order_id"=>$feed['id'],"order_status"=>$feed['status']];
|
|
|
+ $order=["order_type"=>'BHD',"order_code"=>$feed['bk_code'],"order_id"=>$feed['id'],
|
|
|
+ "order_status"=>$feed['status'],"before_status"=>$tem];
|
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
$ste = ["order_code"=>$feed['bk_code'],"status"=>$tem,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
ActionLog::logAdd($this->post['token'],$ste,"BHD",$feed['status'],$feed);
|
|
@@ -614,7 +614,7 @@ class Resign extends Base
|
|
|
Db::rollback();
|
|
|
return error_show(1001,'备库反馈数据状态修改失败');
|
|
|
}
|
|
|
- $order=["order_type"=>'FKD',"order_code"=>$feed['bk_code'],"order_id"=>$purse['id'],"order_status"=>$purse['status']];
|
|
|
+ $order=["order_type"=>'FKD',"order_code"=>$feed['bk_code'],"order_id"=>$purse['id'],"order_status"=>$purse['status'],"before_status"=>$pe];
|
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
$ste = ["order_code"=>$feed['bk_code'],"status"=>$pe,"action_remark"=>'',"action_type"=>"status"];
|
|
|
ActionLog::logAdd($this->post['token'],$ste,"FKD",$feed['status'],$purse);
|
|
@@ -655,7 +655,8 @@ class Resign extends Base
|
|
|
];
|
|
|
$in= Db::name("purchease_order")->insert($data,true);
|
|
|
if($in>0){
|
|
|
- $order=["order_type"=>'CGD',"order_code"=>$data['cgdNo'],"order_id"=>$in,"order_status"=>$data['status']];
|
|
|
+ $order=["order_type"=>'CGD',"order_code"=>$data['cgdNo'],"order_id"=>$in,
|
|
|
+ "order_status"=>$data['status'],"before_status"=>0];
|
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
$ste = ["order_code"=>$inw,"status"=>$data['status'],"action_remark"=>'',"action_type"=>"create"];
|
|
|
ActionLog::logAdd($this->post['token'],$ste,"CGD",$data['status'],$data);
|
|
@@ -677,7 +678,7 @@ class Resign extends Base
|
|
|
Db::rollback();
|
|
|
return error_show(1001,'备库反馈数据状态修改失败');
|
|
|
}
|
|
|
- $order=["order_type"=>'FKD',"order_code"=>$feed['bk_code'],"order_id"=>$purse['id'],"order_status"=>$purse['status']];
|
|
|
+ $order=["order_type"=>'FKD',"order_code"=>$feed['bk_code'],"order_id"=>$purse['id'],"order_status"=>$purse['status'],"before_status"=>1];
|
|
|
ProcessOrder::AddProcess($this->post['token'],$order);
|
|
|
$ste = ["order_code"=>$feed['bk_code'],"status"=>$pe,"action_remark"=>'',"action_type"=>"status"];
|
|
|
ActionLog::logAdd($this->post['token'],$ste,"FKD",$feed['status'],$purse);
|