|
@@ -862,6 +862,11 @@ class After extends Base
|
|
|
return error_show(1005,"参数post_fee不能为空");
|
|
|
}
|
|
|
}
|
|
|
+ $sale= Db::name('sale')->where(['orderCode'=>$info['orderCode'],"is_del"=>0])->find();
|
|
|
+ if($sale==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"未找到销售单数据");
|
|
|
+ }
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
$returninfo = Db::name("order_returninfo")->where(["returnCode"=>$bkcode])->find();
|
|
@@ -917,7 +922,6 @@ class After extends Base
|
|
|
"good_code"=>$info["good_code"],
|
|
|
"good_name"=>$info["good_name"],
|
|
|
"return_wsm"=>$returninfo["return_wsm"],
|
|
|
-// "defective_wsm"=>'',
|
|
|
"return_msg"=>$info["error_msg"],
|
|
|
"return_num"=>$info["error_num"],
|
|
|
"normal_num"=>0,
|
|
@@ -935,7 +939,7 @@ class After extends Base
|
|
|
"post_code"=>$returninfo["post_code"],
|
|
|
"post_company"=>$returninfo["post_company"],
|
|
|
"customer_code"=>$info["customer_code"],
|
|
|
- "status"=>1,
|
|
|
+ "status"=>$info['return_tag']==1?4:1,
|
|
|
"addtime"=>date("Y-m-d H:i:s"),
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
|
];
|
|
@@ -956,14 +960,42 @@ class After extends Base
|
|
|
"order_id" => $sav,
|
|
|
"order_status" => $thdata['status'],"before_status"=>1
|
|
|
]);
|
|
|
+ if($info['return_tag']==1){
|
|
|
+ $sale['th_num']+= $info['error_num'];
|
|
|
+ $sale['th_fee']+= round($info['error_num']*$sale['sale_price'],2);
|
|
|
+ $sale['updatetime']= date("Y-m-d H:i:s");
|
|
|
+ $uap=Db::name("sale")->save($sale);
|
|
|
+ if($uap==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1005,'销售单订单更新失败');
|
|
|
+ }
|
|
|
+ $ordernum =Db::name("order_num")->where(['orderCode'=>$info['orderCode']])->find();
|
|
|
+ if($ordernum==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1005,'未找到关联采购单');
|
|
|
+ }
|
|
|
+ $ordernum['send_num']-=$info['error_num'];
|
|
|
+ $orderup =Db::name("order_num")->save($ordernum);
|
|
|
+ if($orderup==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1005,'关联数据更新失败');
|
|
|
+ }
|
|
|
+ $cgd =Db::name("purchease_order")->where(["cgdNo"=>$ordernum['cgdNo'],"is_del"=>0])->find();
|
|
|
+ if($cgd==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1005,'未找到采购单数据');
|
|
|
+ }
|
|
|
+ $cgd['th_num']+= $info['error_num'];
|
|
|
+ $cgd['th_fee']+= round($info['error_num']*$cgd['good_price'],2);
|
|
|
+ $cgd['updatetime']= date("Y-m-d H:i:s");
|
|
|
+ $cgdup =Db::name("purchease_order")->save($cgd);
|
|
|
+ if($cgdup==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1005,'采购单数据更新失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
-// $out['status']=$info['is_receive']==1&&$info['total_num']>$info['error_num'] ?3:4;
|
|
|
-// $out['updatetime']=date("Y-m-d H:i:s");
|
|
|
-// $outup=Db::name("order_out")->save($out);
|
|
|
-// if($outup==false){
|
|
|
-// Db::rollback();
|
|
|
-// return error_show(1005,"发货单更新失败");
|
|
|
-// }
|
|
|
Db::commit();
|
|
|
return app_show(0,"退货单新建成功",["thNo"=>$thNo]);
|
|
|
}
|