|
@@ -4172,7 +4172,7 @@ class Sale extends Base
|
|
|
$sale_infos = Db::name("sale")
|
|
|
->where('orderCode', $order_out_infos[$value['outCode']]['orderCode'])
|
|
|
->where('is_del', 0)
|
|
|
- ->column('id,send_num,wsend_num,status,good_code', 'orderCode');
|
|
|
+ ->column('id,send_num,wsend_num,status,good_code,order_source', 'orderCode');
|
|
|
|
|
|
if (!isset($sale_infos[$order_out_infos[$value['outCode']]['orderCode']])) throw new Exception($value['outCode'] . '该发货单对应的销售单未找到');
|
|
|
|
|
@@ -4275,6 +4275,8 @@ class Sale extends Base
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
} else throw new Exception($value['outCode'] . '发货失败');
|
|
|
|
|
|
}
|
|
@@ -4283,13 +4285,34 @@ class Sale extends Base
|
|
|
|
|
|
Db::commit();
|
|
|
|
|
|
- return app_show(0, "发货成功");
|
|
|
-
|
|
|
} catch (Exception $exception) {
|
|
|
Db::rollback();
|
|
|
return error_show(1004, $exception->getMessage());
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //如果是有赞订单的话,将发货信息推到有赞
|
|
|
+ //有赞信息有可能推送失败(比如超过72小时,不允许多次修改等),所以不应该和这里的事务放到一起
|
|
|
+ $yz_error = [];
|
|
|
+ foreach ($param['list'] as $value) {
|
|
|
+
|
|
|
+ //每次循环都需要重新查询对应数据,为了数据及时更新
|
|
|
+ $sale_infos = Db::name("sale")
|
|
|
+ ->where('orderCode', $order_out_infos[$value['outCode']]['orderCode'])
|
|
|
+ ->where('is_del', 0)
|
|
|
+ ->column('id,order_source', 'orderCode');
|
|
|
+
|
|
|
+ if ($sale_infos[$order_out_infos[$value['outCode']]['orderCode']]['order_source'] == 5) {
|
|
|
+ $res = curl_request(config('app.yz_domain') . 'api/yz_out_send', ['orderCode' => $order_out_infos[$value['outCode']]['orderCode'], 'out_stype' => isset($value['post_name']) ? $value['post_name'] : '', 'post_code' => $value['post_code'], 'uid' => $createrid, 'uname' => $creater, 'order_out' => $value['outCode']]);
|
|
|
+ $res = json_decode($res, true);
|
|
|
+ if ($res['code'] != 0) $yz_error[] = $res['message'];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (empty($yz_error)) return app_show(0, '发货成功');
|
|
|
+ else app_show(0, '发货成功', $yz_error);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//获取物流信息
|