|
@@ -863,16 +863,16 @@ class Reorder extends Base
|
|
|
$orderinfo = Db::name("sale")->where(["orderCode" => $info["orderCode"]])->findOrEmpty();
|
|
|
if (empty($orderinfo)) return json_show(1004, "未找到订单数据");
|
|
|
|
|
|
-// if ($status == 4) {
|
|
|
-// if ($info['is_addr'] == 1) {
|
|
|
-// $addr = Db::name("sale_returnaddr")
|
|
|
-// ->where(['returnCode' => $info['returnCode'], "is_del" => 0])
|
|
|
-// ->select()
|
|
|
-// ->toArray();
|
|
|
-// if (empty($addr)) return json_show(1004, "未找到发货单地址数据");
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if ($status == 4) {
|
|
|
+ if ($info['is_addr'] == 1) {
|
|
|
+ $addr = Db::name("sale_returnaddr")
|
|
|
+ ->where(['returnCode' => $info['returnCode'], "is_del" => 0])
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+ if (empty($addr)) return json_show(1004, "未找到发货单地址数据");
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
// if($status==3){
|
|
|
// $is_th =isset($this->post['is_th'])&&$this->post['is_th']!=="" ? intval($this->post['is_th']):"";
|
|
|
// if($is_th===""){
|
|
@@ -917,40 +917,48 @@ class Reorder extends Base
|
|
|
$ste = ["order_code" => $code, "status" => $temp, "action_remark" => '', "action_type" => "status"];
|
|
|
ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], $ste, "XSTHD", $status, $info);
|
|
|
if ($status == 4) {
|
|
|
-// if ($info['is_addr'] == 1) {
|
|
|
-// if (isset($addr) && !empty($addr)) {
|
|
|
-// foreach ($addr as $value) {
|
|
|
-// $addrinfo = Db::name("order_addr")
|
|
|
-// ->where(['id' => $value['addrid'], "is_del" => 0])
|
|
|
-// ->findOrEmpty();
|
|
|
-// if (empty($addrinfo)) throw new Exception("地址数据未找到");
|
|
|
-//
|
|
|
-// if ($addrinfo['receipt_quantity'] < $value['return_num']) throw new Exception("地址发货数量不足");
|
|
|
-//
|
|
|
-// $addrinfo['receipt_quantity'] -= $value['return_num'];
|
|
|
-// $addrinfo['is_del'] = $addrinfo['receipt_quantity'] <= 0 ? 1 : 0;
|
|
|
-// $addrinfo['updatetime'] = $date;
|
|
|
-// $addrup = Db::name("order_addr")->save($addrinfo);
|
|
|
-// if ($addrup == false) throw new Exception('地址发货数量更新失败');
|
|
|
-//
|
|
|
-// if ($value['outCode'] != "") {
|
|
|
-// $out = Db::name("order_out")->where(["outCode" => $value['outCode']])->findOrEmpty();
|
|
|
-// if (empty($out)) throw new Exception('地址发货单数据未找到');
|
|
|
-//
|
|
|
-// if ($out['status'] >= 2) throw new Exception('地址发货单已发货');
|
|
|
-//
|
|
|
-// if ($out['send_num'] < $value['return_num']) throw new Exception('地址发货单发货数量不足');
|
|
|
-//
|
|
|
-// $out['send_num'] -= $value['return_num'];
|
|
|
-// $out['is_del'] = $out['send_num'] <= 0 ? 1 : 0;
|
|
|
-// $out['updatetime'] = $date;
|
|
|
-// $outup = Db::name("order_out")->save($out);
|
|
|
-// if ($outup == false) throw new Exception('地址发货单更新失败');
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if ($info['is_addr'] == 1) {
|
|
|
+ if (isset($addr) && !empty($addr)) {
|
|
|
+ foreach ($addr as $value) {
|
|
|
+ $addrinfo = Db::name("order_addr")
|
|
|
+ ->where(['id' => $value['addrid'], "is_del" => 0])
|
|
|
+ ->findOrEmpty();
|
|
|
+ if (empty($addrinfo)) throw new Exception("地址数据未找到");
|
|
|
+
|
|
|
+ if ($addrinfo['receipt_quantity'] < $value['return_num']) throw new Exception("地址发货数量不足");
|
|
|
+
|
|
|
+ $addrinfo['receipt_quantity'] -= $value['return_num'];
|
|
|
+ $addrinfo['is_del'] = $addrinfo['receipt_quantity'] <= 0 ? 1 : 0;
|
|
|
+ $addrinfo['updatetime'] = $date;
|
|
|
+ $addrup = Db::name("order_addr")->save($addrinfo);
|
|
|
+ if ($addrup == false) throw new Exception('地址发货数量更新失败');
|
|
|
+
|
|
|
+ if ($value['outCode'] != "") {
|
|
|
+ $out = Db::name("order_out")->where(["outCode" => $value['outCode']])->findOrEmpty();
|
|
|
+ if (empty($out)) throw new Exception('地址发货单数据未找到');
|
|
|
+
|
|
|
+ if ($out['status'] >= 2) throw new Exception('地址发货单已发货');
|
|
|
+
|
|
|
+ if ($out['send_num'] < $value['return_num']) throw new Exception('地址发货单发货数量不足');
|
|
|
+
|
|
|
+ $out['send_num'] -= $value['return_num'];
|
|
|
+ $out['is_del'] = $out['send_num'] <= 0 ? 1 : 0;
|
|
|
+ $out['updatetime'] = $date;
|
|
|
+ $outup = Db::name("order_out")->save($out);
|
|
|
+ if ($outup == false) throw new Exception('地址发货单更新失败');
|
|
|
+
|
|
|
+ //维护发货工单的数量
|
|
|
+ Db::name('order_out_child')
|
|
|
+ ->where(['is_del' => 0, 'outCode' => $value['outCode']])
|
|
|
+ ->limit(1)
|
|
|
+ ->dec('num', $value['return_num'])
|
|
|
+ ->update(['updatetime' => $date]);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if ($orderinfo['wsend_num'] < $info['num']) throw new Exception('销售单未发货数量不足退货');
|
|
|
|