|
@@ -48,21 +48,21 @@ class After extends \app\BaseController
|
|
|
return error_show(1004,"参数 num 不能为空或零");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- $order_type =isset($this->post['order_type']) &&$this->post['order_type']!=''?intval($this->post['order_type']) :"";
|
|
|
-// if($order_type==""){
|
|
|
-// return error_show(1004,"参数 order_type 不能为空或零");
|
|
|
-// }
|
|
|
$remark =isset($this->post['remark']) &&$this->post['remark']!=''?trim($this->post['remark']) :"";
|
|
|
+ $is_receive =isset($this->post['is_receive']) &&$this->post['is_receive']!==''?intval($this->post['is_receive'])
|
|
|
+ :"";
|
|
|
+ if($is_receive===""){
|
|
|
+ return error_show(1004,"参数 is_receive 不能为空");
|
|
|
+ }
|
|
|
$except_code =isset($this->post['except_code']) &&$this->post['except_code']!=''?trim($this->post['except_code']) :"";
|
|
|
$img = isset($this->post['img']) &&$this->post['img']!=''?trim($this->post['img']) :"";
|
|
|
$token = isset($this->post['token'])&&$this->post['token']!='' ? trim($this->post['token']):"";
|
|
|
if($token==''){
|
|
|
- return error_show(1005,"参数token不能为空");
|
|
|
+ return error_show(105,"参数token不能为空");
|
|
|
}
|
|
|
$user =GetUserInfo($token);
|
|
|
if(empty($user)||$user['code']!=0){
|
|
|
- return error_show(1002,"申请人数据不存在");
|
|
|
+ return error_show(102,"申请人数据不存在");
|
|
|
}
|
|
|
$rm= isset($user["data"]['id']) ? $user["data"]['id'] : "";
|
|
|
$ri= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
|
|
@@ -79,13 +79,13 @@ class After extends \app\BaseController
|
|
|
"apply_id"=>$rm,
|
|
|
"apply_name"=>$ri,
|
|
|
"order_status"=>$orde_status,
|
|
|
- // 'total_num'=>$oder['send_num'],
|
|
|
'total_num'=>$orderout['send_num'],
|
|
|
"error_code"=>$errorCode,
|
|
|
"error_num"=>$num,
|
|
|
"error_img"=>$img,
|
|
|
"error_msg"=>$error['result'],
|
|
|
"error_remark"=>$remark,
|
|
|
+ "is_receive"=>$is_receive,
|
|
|
"remark"=>'',
|
|
|
"except_code"=>$except_code,
|
|
|
"order_type"=>$orderout['order_type'],
|
|
@@ -248,7 +248,14 @@ class After extends \app\BaseController
|
|
|
if($remark!=''){
|
|
|
$info['remark'] =$remark;
|
|
|
}
|
|
|
- $status = $info['order_status']==1&&$info['order_type']==1 && $status==1?4:$status;
|
|
|
+ if($status==3){
|
|
|
+ $post =isset($this->post['is_post'])&&$this->post['is_post']!==""? intval($this->post['is_post']):"";
|
|
|
+ if($post===""){
|
|
|
+ return error_show(1005,"参数is_post不能为空");
|
|
|
+ }
|
|
|
+ $info['is_post']=$post;
|
|
|
+ }
|
|
|
+// $status = $info['order_status']==1&&$info['order_type']==1 && $status==1?4:$status;
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
$var=$info['status'];
|
|
@@ -256,20 +263,20 @@ class After extends \app\BaseController
|
|
|
$info['updatetime']=date("Y-m-d H:i:s");
|
|
|
$up =Db::name("order_return")->save($info);
|
|
|
if($up){
|
|
|
- if($info['order_status']==1&&$info['order_type']==1 && $status==4){
|
|
|
- $orderout= Db::name("order_out")->where($orde)->save(['status'=>3,"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
- $order = ["order_code"=>$orde['outCode'],"status"=>$orde['status'],"action_remark"=>'',"action_type"=>"edit"];
|
|
|
- ActionLog::logAdd($this->post['token'],$order,$orde['order_type']==1?'CKD':"ZXCKD", 3,['status'=>3,"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
- $process=["order_code"=>$orde['outCode'],"order_id"=>$orde['id'],"order_status"=>3,"order_type"=>$orde['order_type']==1?'CKD':"ZXCKD"];
|
|
|
- ProcessOrder::AddProcess($this->post['token'],$process);
|
|
|
- if($orderout){
|
|
|
- Db::commit();
|
|
|
- return app_show(0,"更新成功");
|
|
|
- }else{
|
|
|
- Db::rollback();
|
|
|
- return error_show(1004,"更新失败");
|
|
|
- }
|
|
|
- }
|
|
|
+// if($info['order_status']==1&&$info['order_type']==1 && $status==4){
|
|
|
+// $orderout= Db::name("order_out")->where($orde)->save(['status'=>3,"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
+// $order = ["order_code"=>$orde['outCode'],"status"=>$orde['status'],"action_remark"=>'',"action_type"=>"edit"];
|
|
|
+// ActionLog::logAdd($this->post['token'],$order,$orde['order_type']==1?'CKD':"ZXCKD", 3,['status'=>3,"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
+// $process=["order_code"=>$orde['outCode'],"order_id"=>$orde['id'],"order_status"=>3,"order_type"=>$orde['order_type']==1?'CKD':"ZXCKD"];
|
|
|
+// ProcessOrder::AddProcess($this->post['token'],$process);
|
|
|
+// if($orderout){
|
|
|
+// Db::commit();
|
|
|
+// return app_show(0,"更新成功");
|
|
|
+// }else{
|
|
|
+// Db::rollback();
|
|
|
+// return error_show(1004,"更新失败");
|
|
|
+// }
|
|
|
+// }
|
|
|
$order = ["order_code"=>$info['returnCode'],"status"=>$var,"action_remark"=>'',"action_type"=>"edit"];
|
|
|
ActionLog::logAdd($this->post['token'],$order,$info['order_type']==1?'SHD':"ZXSHD", $info['status'],$this->post);
|
|
|
$process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$status,"order_type"=>$info['order_type']==1?'SHD':"ZXSHD"];
|
|
@@ -287,6 +294,68 @@ class After extends \app\BaseController
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public function setWsm(){
|
|
|
+ $bkcode = isset($this->post['returnCode']) && $this->post['returnCode']!="" ? trim($this->post['returnCode']):"";
|
|
|
+ if($bkcode==""){
|
|
|
+ return error_show(1005,"参数returnCode 不能为空");
|
|
|
+ }
|
|
|
+ $info = Db::name("order_return")->where(['returnCode'=>$bkcode])->find();
|
|
|
+ if(empty($info)){
|
|
|
+ return error_show(1005,"未找到售后数据");
|
|
|
+ }
|
|
|
+ if($info['status']!=3){
|
|
|
+ return error_show(1005,"采购主管未审核无法设置退回仓库");
|
|
|
+ }
|
|
|
+ $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code']!="" ? trim($this->post['wsm_code'])
|
|
|
+ :"";
|
|
|
+ if($wsm_code==""){
|
|
|
+ return error_show(1005,"参数wsm_code 不能为空");
|
|
|
+ }
|
|
|
+ $addrcode=isset($this->post['addr_code'])&&$this->post['addr_code']!=""?$this->post['addr_code']:"";
|
|
|
+ if($addrcode==""){
|
|
|
+ return error_show(1005,"参数 addr_code 不能为空");
|
|
|
+ }
|
|
|
+ $addr=isset($this->post['addr'])&&$this->post['addr']!=""?trim($this->post['addr']):"";
|
|
|
+ if($addr==""){
|
|
|
+ return error_show(1005,"参数 addr 不能为空");
|
|
|
+ }
|
|
|
+ $mobile=isset($this->post['mobile'])&&$this->post['mobile']!=""?trim($this->post['mobile']):"";
|
|
|
+ if($mobile==""){
|
|
|
+ return error_show(1005,"参数 mobile 不能为空");
|
|
|
+ }
|
|
|
+ $contactor=isset($this->post['contactor'])&&$this->post['contactor']!=""?trim($this->post['contactor']):"";
|
|
|
+ if($contactor==""){
|
|
|
+ return error_show(1005,"参数 contactor 不能为空");
|
|
|
+ }
|
|
|
+ $returninfo=[
|
|
|
+ "returnCode"=>$bkcode,
|
|
|
+ "return_wsm"=>$wsm_code,
|
|
|
+ "contactor"=>$contactor,
|
|
|
+ "mobile"=>$mobile ,
|
|
|
+ "addr"=>$addr,
|
|
|
+ "addr_code"=>$addrcode,
|
|
|
+ "addtime"=>date("Y-m-d H:i:s")
|
|
|
+ ];
|
|
|
+ Db::startTrans();
|
|
|
+ try {
|
|
|
+ $in=Db::name("order_returninfo")->insert($returninfo);
|
|
|
+ if($in){
|
|
|
+ $info['status']=4;
|
|
|
+ $info["updatetime"]=date("Y-m-d H:i:s");
|
|
|
+ $up =Db::name("order_return")->save($info);
|
|
|
+ if($up){
|
|
|
+ Db::commit();
|
|
|
+ return app_show(0,"退货仓库设置成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"设置失败");
|
|
|
+ }catch (\Exception $e){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,$e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @return \think\response\Json|void
|
|
|
* @throws \think\db\exception\DataNotFoundException
|