|
@@ -73,17 +73,9 @@ class Reorder extends \app\BaseController
|
|
|
ActionLog::logAdd($this->post['token'],$stn,"QRTHD",0,$stn);
|
|
|
$process=["order_code"=>$returnCode,"order_id"=>$create,"order_status"=>0,"order_type"=>'QRTHD'];
|
|
|
ProcessOrder::AddProcess($this->post['token'],$process);
|
|
|
+ Db::commit();
|
|
|
+ return app_show(0,"退货单新建成功",["returnCode"=>$returnCode]);
|
|
|
|
|
|
- $order['wsend_num']-=$thnum;
|
|
|
- $order['good_num']-=$thnum;
|
|
|
- $order['send_status'] = $order['send_num'] == 0 ? 1 : $order['wsend_num'] == 0 ? 3 : 2;
|
|
|
- $order['status'] = $order['send_num'] == 0 ? 3 : $order['wsend_num'] == 0 ? 5 : 4;
|
|
|
- $order['updatetime']=date("Y-m-d H:i:s");
|
|
|
- $return = Db::name("sale")->save($order);
|
|
|
- if($return){
|
|
|
- Db::commit();
|
|
|
- return app_show(0,"退货单新建成功",["returnCode"=>$returnCode]);
|
|
|
- }
|
|
|
}
|
|
|
Db::rollback();
|
|
|
return error_show(1005,"退货单新建失败");
|
|
@@ -307,6 +299,16 @@ class Reorder extends \app\BaseController
|
|
|
$rid= isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : "";
|
|
|
$rname= isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : "";
|
|
|
|
|
|
+ $orderinfo = Db::name("sale")->where(["orderCode"=>$info["orderCode"]])->find();
|
|
|
+ if($orderinfo==false){
|
|
|
+ return error_show(1004,"未找到订单数据");
|
|
|
+ }
|
|
|
+ if($status==5){
|
|
|
+ $good_stock = Db::name("good_stock")->where(["spuCode"=>$orderinfo['good_code'],"is_del"=>0])->find();
|
|
|
+ if($good_stock==false){
|
|
|
+ return error_show(1004,"未找到商品库存数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
Db::startTrans();
|
|
|
try{
|
|
|
$temp= $info['status'];
|
|
@@ -319,12 +321,24 @@ class Reorder extends \app\BaseController
|
|
|
ProcessOrder::AddProcess($this->post['token'],$process);
|
|
|
$ste = ["order_code"=>$code,"status"=>$temp,"action_remark"=>'',"action_type"=>"status"];
|
|
|
ActionLog::logAdd($this->post['token'],$ste,$info['order_type'] == 2?"ZXTHD":"QRTHD",$status,$info);
|
|
|
+ if($status==5){
|
|
|
+ $orderinfo['wsend_num']-=$info['num'];
|
|
|
+ $orderinfo['th_num']+=$info['num'];
|
|
|
+ $orderinfo['send_status'] = $orderinfo['send_num'] == 0 ? 1 : $orderinfo['wsend_num'] == 0 ? 3 : 2;
|
|
|
+ $orderinfo['status'] = $orderinfo['send_num'] == 0 ? 3 : $orderinfo['wsend_num'] == 0 ? 5 : 4;
|
|
|
+ $orderinfo['updatetime']=date("Y-m-d H:i:s");
|
|
|
+ $return = Db::name("sale")->save($orderinfo);
|
|
|
+ if($return==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"更新失败");
|
|
|
+ }
|
|
|
+ $good_stock[]
|
|
|
+ }
|
|
|
Db::commit();
|
|
|
return app_show(0,"更新成功");
|
|
|
- }else{
|
|
|
+ }
|
|
|
Db::rollback();
|
|
|
return error_show(1004,"更新失败");
|
|
|
- }
|
|
|
}catch (\Exception $e){
|
|
|
Db::rollback();
|
|
|
return error_show(1004,"更新失败");
|