|
@@ -158,6 +158,43 @@ class Resign extends BaseController
|
|
|
return $in ? app_show(0,"新建成功",['bk_code'=>$bk_code]):error_show(1005,"新建失败");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return \think\response\Json|void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ */
|
|
|
+ public function copy(){
|
|
|
+ $id = isset($this->post['id']) ? intval($this->post['id']) : "";
|
|
|
+ if($id==""){
|
|
|
+ return error_show(1001,'id不能为空');
|
|
|
+ }
|
|
|
+ $info = Db::name("purchease")->where(["id"=>$id,"is_del"=>0])->find();
|
|
|
+ if(empty($info)){
|
|
|
+ return error_show(1002,'未找到数据');
|
|
|
+ }
|
|
|
+ $data = GetUserInfo($this->post['token']);
|
|
|
+ if((!empty($data) && $data['code']!=0) ||empty($data) ){
|
|
|
+ return error_show($data['code'],$data['message']);
|
|
|
+ }
|
|
|
+ $userinfo = $data['data'];
|
|
|
+ $bk_code=makeNo("BK");
|
|
|
+ $info['bk_code']=$bk_code;
|
|
|
+ $info['status']=0;
|
|
|
+ $info['addtime']=date("Y-m-d H:i:s");
|
|
|
+ $info['updatetime']=date("Y-m-d H:i:s");
|
|
|
+ $info['apply_id']=$userinfo['id'];
|
|
|
+ $info['apply_name']=$userinfo['nickname'];
|
|
|
+ unset($info['id']);
|
|
|
+ $in = Db::name("purchease")->insert($info);
|
|
|
+ return $in ? app_show(0,"新建成功",['bk_code'=>$bk_code]):error_show(1005,"新建失败");
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @return \think\response\Json|void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ */
|
|
|
public function info(){
|
|
|
$id = isset($this->post['id']) ? intval($this->post['id']) : "";
|
|
|
if($id==""){
|
|
@@ -362,8 +399,26 @@ class Resign extends BaseController
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
|
];
|
|
|
- $in = Db::name('purchease_feedback')->insert($data);
|
|
|
- return $in ? app_show(0,"新建成功"):error_show(1005,"新建失败");
|
|
|
+ Db::startTrans();
|
|
|
+ try{
|
|
|
+ $in = Db::name('purchease_feedback')->insert($data);
|
|
|
+ if($in){
|
|
|
+ $info['status']=2;
|
|
|
+ $info['addtime']=date("Y-m-d H:i:s");
|
|
|
+ $ood=Db::name('purchease')->save($info);
|
|
|
+ if($ood){
|
|
|
+ Db::commit();
|
|
|
+ return app_show(0,"新建成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1005,"新建失败");
|
|
|
+ }catch (\Exception $e){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1005,"新建失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ // return $in ? app_show(0,"新建成功"):error_show(1005,"新建失败");
|
|
|
}
|
|
|
|
|
|
public function delFeed(){
|
|
@@ -395,7 +450,7 @@ class Resign extends BaseController
|
|
|
}
|
|
|
$feed = Db::name("purchease_feedback")->where(['bkcode'=>$info['bk_code'],'is_del'=>0])->find();
|
|
|
if(empty($feed)){
|
|
|
- return error_show(1004,'未找到数据');
|
|
|
+ return error_show(1004,'未找到反馈数据');
|
|
|
}
|
|
|
$feed['wsm_name']="";
|
|
|
if($feed['warehouse']!=""){
|
|
@@ -413,7 +468,7 @@ class Resign extends BaseController
|
|
|
if($id==""){
|
|
|
return error_show(1001,'id不能为空');
|
|
|
}
|
|
|
- $feed = Db::name("purchease_feedback")->where(['id'=>$id,'is_del'=>0])->find();
|
|
|
+ $feed = Db::name("purchease")->where(['id'=>$id,'is_del'=>0])->find();
|
|
|
if(empty($feed)){
|
|
|
return error_show(1004,'未找到数据');
|
|
|
}
|
|
@@ -427,44 +482,51 @@ class Resign extends BaseController
|
|
|
$feed['remark']= $remark;
|
|
|
$feed['status']= $status;
|
|
|
$feed['updatetime']=date("Y-m-d H:i:s");
|
|
|
- $up = Db::name("purchease_feedback")->update($feed);
|
|
|
+ $up = Db::name("purchease")->update($feed);
|
|
|
if($up){
|
|
|
- if($status==1){
|
|
|
+ if($status==3){
|
|
|
// $ware = Db::name("warehouse_addr")->where(["wsm_code"=>$feed['warehouse'],"is_del"=>0])->find();
|
|
|
- $purse = Db::name("purchease")->where(['bk_code'=>$feed['bkcode'],"is_del"=>0])->find();
|
|
|
+ $purse = Db::name("purchease_feedback")->where(['bkcode'=>$feed['bk_code'],"is_del"=>0])->find();
|
|
|
if(empty($purse)){
|
|
|
Db::rollback();
|
|
|
- return error_show(1001,'未找到备库申请数据');
|
|
|
+ return error_show(1001,'未找到备库反馈数据');
|
|
|
+ }
|
|
|
+ $purse['status']=1;
|
|
|
+ $purse['addtime']=date("Y-m-d H:i:s");
|
|
|
+ $up = Db::name("purchease_feedback")->save($purse);
|
|
|
+ if($up==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1001,'备库反馈数据状态修改失败');
|
|
|
}
|
|
|
- $supplier = Db::name("supplier")->where(["code"=>$feed['supplier']])->find();
|
|
|
+ $supplier = Db::name("supplier")->where(["code"=>$purse['supplier']])->find();
|
|
|
$inw = makeNo("CG");
|
|
|
$data=[
|
|
|
- "bkcode"=>$feed['bkcode'],
|
|
|
+ "bkcode"=>$purse['bkcode'],
|
|
|
'cgdNo'=>$inw,
|
|
|
- "wsm_code"=>$feed['warehouse'],
|
|
|
- "good_code"=>$purse['good_code'],
|
|
|
- "good_name"=>$purse['good_name'],
|
|
|
- "good_type_code"=>$purse['good_type_code'],
|
|
|
- "good_num"=>$purse['good_num'],
|
|
|
+ "wsm_code"=>$purse['warehouse'],
|
|
|
+ "good_code"=>$feed['good_code'],
|
|
|
+ "good_name"=>$feed['good_name'],
|
|
|
+ "good_type_code"=>$feed['good_type_code'],
|
|
|
+ "good_num"=>$feed['good_num'],
|
|
|
"send_num"=>0,
|
|
|
- "wsend_num"=>$purse['good_num'],
|
|
|
- 'good_price'=>$feed['good_price'],
|
|
|
- "total_fee"=>$feed['good_price'],
|
|
|
- 'pakge_fee'=>$feed['pakge_fee'],
|
|
|
- 'cert_fee'=>$feed['cert_fee'],
|
|
|
- 'open_fee'=>$feed['open_fee'],
|
|
|
- 'mark_fee'=>$feed['mark_fee'],
|
|
|
- 'teach_fee'=>$feed['teach_fee'],
|
|
|
- 'nake_fee'=>$feed['nake_fee'],
|
|
|
- 'delivery_fee'=>$feed['delivery_fee'],
|
|
|
- 'weight'=>$feed['weight'],
|
|
|
- 'diff_weight'=>$feed['diff_weight'],
|
|
|
- 'diff_price'=>$feed['diff_price'],
|
|
|
- 'cgder_id'=>$feed['purchaser_id'],
|
|
|
- 'cgder'=>$feed['purchaser'],
|
|
|
- 'supplierNo'=>$feed['supplier'],
|
|
|
+ "wsend_num"=>$feed['good_num'],
|
|
|
+ 'good_price'=>$purse['good_price'],
|
|
|
+ "total_fee"=>$purse['good_price'],
|
|
|
+ 'pakge_fee'=>$purse['pakge_fee'],
|
|
|
+ 'cert_fee'=>$purse['cert_fee'],
|
|
|
+ 'open_fee'=>$purse['open_fee'],
|
|
|
+ 'mark_fee'=>$purse['mark_fee'],
|
|
|
+ 'teach_fee'=>$purse['teach_fee'],
|
|
|
+ 'nake_fee'=>$purse['nake_fee'],
|
|
|
+ 'delivery_fee'=>$purse['delivery_fee'],
|
|
|
+ 'weight'=>$purse['weight'],
|
|
|
+ 'diff_weight'=>$purse['diff_weight'],
|
|
|
+ 'diff_fee'=>$purse['diff_price'],
|
|
|
+ 'cgder_id'=>$purse['purchaser_id'],
|
|
|
+ 'cgder'=>$purse['purchaser'],
|
|
|
+ 'supplierNo'=>$purse['supplier'],
|
|
|
'supplier_name'=>isset($supplier['name']) ? $supplier['name']:"",
|
|
|
- 'lasttime'=>$feed['expecttime'],
|
|
|
+ 'lasttime'=>$purse['expecttime'],
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
|
];
|
|
@@ -474,6 +536,20 @@ class Resign extends BaseController
|
|
|
return app_show(0,"更新成功",['cgdNo'=>$inw]);
|
|
|
}
|
|
|
}else{
|
|
|
+ if($status==4){
|
|
|
+ $purse = Db::name("purchease_feedback")->where(['bkcode'=>$feed['bk_code'],"is_del"=>0])->find();
|
|
|
+ if(empty($purse)){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1001,'未找到备库反馈数据');
|
|
|
+ }
|
|
|
+ $purse['status']=2;
|
|
|
+ $purse['addtime']=date("Y-m-d H:i:s");
|
|
|
+ $up = Db::name("purchease_feedback")->save($purse);
|
|
|
+ if($up==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1001,'备库反馈数据状态修改失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
Db::commit();
|
|
|
return app_show(0,"更新成功");
|
|
|
}
|