|
|
@@ -182,38 +182,35 @@ class OrderController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function actionAllFh()
|
|
|
+ //发货 ssh 20230613
|
|
|
+ public function actionFh()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
- $ids = $post['ids'] ?? '';
|
|
|
- if (empty($ids)) {
|
|
|
- util::fail('请选择要合并发货的订单');
|
|
|
- }
|
|
|
- $arr = explode(',', $ids);
|
|
|
- if (empty($arr)) {
|
|
|
- util::fail('请选择要合并发货的订单哦');
|
|
|
- }
|
|
|
+ $id = $post['id'] ?? '';
|
|
|
+ $order = OrderClass::getById($id, true);
|
|
|
+ OrderClass::valid($order, $this->shopId);
|
|
|
+ $staff = $this->shopAdmin;
|
|
|
+ $staffId = $staff->id ?? 0;
|
|
|
+ $staffName = $staff->name ?? '';
|
|
|
$fhWl = $post['fhWl'] ?? '';
|
|
|
$fhWlNo = $post['fhWlNo'] ?? '';
|
|
|
- $fhType = 0;
|
|
|
+ $fhType = $post['fhType'] ?? '';
|
|
|
$params = [
|
|
|
'fhType' => $fhType,
|
|
|
'fhWl' => $fhWl,
|
|
|
'fhWlNo' => $fhWlNo,
|
|
|
+ 'staffId' => $staffId,
|
|
|
+ 'staffName' => $staffName,
|
|
|
];
|
|
|
+
|
|
|
+ if ($order->book == 1) {
|
|
|
+ util::fail('预订单不能直接发货');
|
|
|
+ }
|
|
|
$connection = Yii::$app->db;
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
|
- $all = OrderClass::getAllByCondition(['id' => ['in', $arr]], null, '*', null, true);
|
|
|
- foreach ($all as $order) {
|
|
|
- if ($order->book == 1) {
|
|
|
- util::fail('有预订单,不能一起发货');
|
|
|
- }
|
|
|
- if ($order->mainId != $this->mainId) {
|
|
|
- util::fail('不是你的订单哦');
|
|
|
- }
|
|
|
- OrderClass::orderSend($order, $params, true);
|
|
|
- }
|
|
|
+ //花店会增加路上库存
|
|
|
+ OrderClass::orderSend($order, $params);
|
|
|
$transaction->commit();
|
|
|
util::complete();
|
|
|
} catch (\Exception $e) {
|
|
|
@@ -223,35 +220,52 @@ class OrderController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //发货 ssh 20230613
|
|
|
- public function actionFh()
|
|
|
+ public function actionAllFh()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
- $id = $post['id'] ?? '';
|
|
|
- $order = OrderClass::getById($id, true);
|
|
|
- OrderClass::valid($order, $this->shopId);
|
|
|
- $staff = $this->shopAdmin;
|
|
|
- $staffId = $staff->id ?? 0;
|
|
|
- $staffName = $staff->name ?? '';
|
|
|
+ $ids = $post['ids'] ?? '';
|
|
|
+ $mergeId = $post['mergeId'] ?? 0;
|
|
|
+ if (empty($ids)) {
|
|
|
+ if (empty($mergeId)) {
|
|
|
+ util::fail('请选择要合并发货的订单');
|
|
|
+ }
|
|
|
+ $mergeInfo = OrderClass::getById($mergeId, true);
|
|
|
+ if (empty($mergeInfo)) {
|
|
|
+ util::fail('请选择要合并发货的订单呢');
|
|
|
+ }
|
|
|
+ if ($mergeInfo->mainId != $this->mainId) {
|
|
|
+ util::fail('不是你的订单呢');
|
|
|
+ }
|
|
|
+ $ids = $mergeInfo->sameTimeIds ?? '';
|
|
|
+ if (empty($ids)) {
|
|
|
+ util::fail('请选择要合并发货的订单哈');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $arr = explode(',', $ids);
|
|
|
+ if (empty($arr)) {
|
|
|
+ util::fail('请选择要合并发货的订单哦');
|
|
|
+ }
|
|
|
$fhWl = $post['fhWl'] ?? '';
|
|
|
$fhWlNo = $post['fhWlNo'] ?? '';
|
|
|
- $fhType = $post['fhType'] ?? '';
|
|
|
+ $fhType = 0;
|
|
|
$params = [
|
|
|
'fhType' => $fhType,
|
|
|
'fhWl' => $fhWl,
|
|
|
'fhWlNo' => $fhWlNo,
|
|
|
- 'staffId' => $staffId,
|
|
|
- 'staffName' => $staffName,
|
|
|
];
|
|
|
-
|
|
|
- if ($order->book == 1) {
|
|
|
- util::fail('预订单不能直接发货');
|
|
|
- }
|
|
|
$connection = Yii::$app->db;
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
|
- //花店会增加路上库存
|
|
|
- OrderClass::orderSend($order, $params);
|
|
|
+ $all = OrderClass::getAllByCondition(['id' => ['in', $arr]], null, '*', null, true);
|
|
|
+ foreach ($all as $order) {
|
|
|
+ if ($order->book == 1) {
|
|
|
+ util::fail('有预订单,不能一起发货');
|
|
|
+ }
|
|
|
+ if ($order->mainId != $this->mainId) {
|
|
|
+ util::fail('不是你的订单哦');
|
|
|
+ }
|
|
|
+ OrderClass::orderSend($order, $params, true);
|
|
|
+ }
|
|
|
$transaction->commit();
|
|
|
util::complete();
|
|
|
} catch (\Exception $e) {
|
|
|
@@ -266,8 +280,22 @@ class OrderController extends BaseController
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
$ids = $post['ids'] ?? '';
|
|
|
+ $mergeId = $post['mergeId'] ?? 0;
|
|
|
if (empty($ids)) {
|
|
|
- util::fail('请选择要合并打印的订单');
|
|
|
+ if (empty($mergeId)) {
|
|
|
+ util::fail('请选择要合并打印的订单');
|
|
|
+ }
|
|
|
+ $mergeInfo = OrderClass::getById($mergeId, true);
|
|
|
+ if (empty($mergeInfo)) {
|
|
|
+ util::fail('请选择要合并打印的订单呢');
|
|
|
+ }
|
|
|
+ if ($mergeInfo->mainId != $this->mainId) {
|
|
|
+ util::fail('不是你的订单呢');
|
|
|
+ }
|
|
|
+ $ids = $mergeInfo->sameTimeIds ?? '';
|
|
|
+ if (empty($ids)) {
|
|
|
+ util::fail('请选择要合并打印的订单哈');
|
|
|
+ }
|
|
|
}
|
|
|
$arr = explode(',', $ids);
|
|
|
if (empty($arr)) {
|
|
|
@@ -286,6 +314,37 @@ class OrderController extends BaseController
|
|
|
util::complete('打印成功');
|
|
|
}
|
|
|
|
|
|
+ //获取合并订单列表 ssh 20260518
|
|
|
+ public function actionMergeOrderList()
|
|
|
+ {
|
|
|
+ //同个人当天订单不可能超过9999
|
|
|
+ Yii::$app->params['pageSize'] = 9999;
|
|
|
+
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $mergeId = $get['mergeId'] ?? '';
|
|
|
+ $mergeInfo = OrderClass::getById($mergeId, true);
|
|
|
+ if (empty($mergeInfo)) {
|
|
|
+ util::fail('请选择订单');
|
|
|
+ }
|
|
|
+ if ($mergeInfo->mainId != $this->mainId) {
|
|
|
+ util::fail('不是你的订单');
|
|
|
+ }
|
|
|
+ $ids = $mergeInfo->sameTimeIds ?? '';
|
|
|
+ if (empty($ids)) {
|
|
|
+ util::fail('请选择订单哈');
|
|
|
+ }
|
|
|
+ $where['mainId'] = $this->mainId;
|
|
|
+ $newIds = explode(',', $ids);
|
|
|
+ if (empty($newIds)) {
|
|
|
+ util::fail('请选订单哈');
|
|
|
+ }
|
|
|
+ $where['id'] = ['in', $newIds];
|
|
|
+ $respond = OrderClass::getOrderList($where);
|
|
|
+ $respond['shop'] = $this->shop;
|
|
|
+ $respond['shopExt'] = $this->shopExt;
|
|
|
+ util::success($respond);
|
|
|
+ }
|
|
|
+
|
|
|
//修改分工 ssh 20221129
|
|
|
public function actionChangeWorker()
|
|
|
{
|