|
|
@@ -10,6 +10,7 @@ use biz\shop\classes\ShopExtClass;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\express\classes\GhsDeliveryOrderClass;
|
|
|
use bizGhs\order\classes\OrderClass;
|
|
|
+use bizGhs\order\classes\OrderMergeSnClass;
|
|
|
use bizHd\purchase\classes\PurchaseClass;
|
|
|
use bizHd\purchase\classes\PurchaseItemClass;
|
|
|
use bizHd\purchase\services\PurchaseService;
|
|
|
@@ -31,7 +32,7 @@ use common\components\push;
|
|
|
class PurchaseController extends BaseController
|
|
|
{
|
|
|
|
|
|
- public $guestAccess = ['detail', 'ali-pay', 'get-ali-pay-code', 'wx-pay'];
|
|
|
+ public $guestAccess = ['detail', 'ali-pay', 'get-ali-pay-code', 'wx-pay', 'merge-order-list'];
|
|
|
|
|
|
//取消采购单 ssh 20250710
|
|
|
public function actionCancel()
|
|
|
@@ -1047,16 +1048,48 @@ class PurchaseController extends BaseController
|
|
|
Yii::$app->params['pageSize'] = 9999;
|
|
|
|
|
|
$get = Yii::$app->request->get();
|
|
|
- $mergeId = $get['mergeId'] ?? 0;
|
|
|
- $ghsId = $get['ghsId'] ?? 0;
|
|
|
- if (empty($mergeId)) {
|
|
|
+ $id = $get['id'] ?? 0;
|
|
|
+ if (empty($id)) {
|
|
|
+ util::fail('请选择采购单');
|
|
|
+ }
|
|
|
+ $order = OrderClass::getById($id, true);
|
|
|
+ if (empty($order)) {
|
|
|
+ util::fail('请选择订单');
|
|
|
+ }
|
|
|
+ $ghsMergeId = $order->mergeId ?? 0;
|
|
|
+ if (empty($ghsMergeId)) {
|
|
|
+ util::fail('请选择合并订单');
|
|
|
+ }
|
|
|
+ $ghsMergeSn = OrderMergeSnClass::getById($ghsMergeId, true);
|
|
|
+ if (empty($ghsMergeSn)) {
|
|
|
+ util::fail('请选择合并订单');
|
|
|
+ }
|
|
|
+ $salt = $get['salt'] ?? '';
|
|
|
+ if (empty($this->shopId)) {
|
|
|
+ if (empty($salt)) {
|
|
|
+ util::fail('请求参数错误');
|
|
|
+ }
|
|
|
+ if (empty($ghsMergeSn->salt) || $ghsMergeSn->salt != $salt) {
|
|
|
+ util::fail('找不到订单');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $purchaseId = $order->purchaseId ?? 0;
|
|
|
+ $purchase = PurchaseClass::getById($purchaseId, true);
|
|
|
+ if (empty($purchase)) {
|
|
|
util::fail('请选择采购单');
|
|
|
}
|
|
|
+ $mergeId = $purchase->mergeId ?? 0;
|
|
|
+ $ghsId = $purchase->ghsId ?? 0;
|
|
|
+ if (empty($mergeId)) {
|
|
|
+ util::fail('请选择合并采购单');
|
|
|
+ }
|
|
|
if (empty($ghsId)) {
|
|
|
util::fail('请选择供货商');
|
|
|
}
|
|
|
$ghsInfo = GhsClass::getGhsInfo($ghsId);
|
|
|
- GhsClass::valid($ghsInfo, $this->shopId);
|
|
|
+ if (!empty($this->shopId)) {
|
|
|
+ GhsClass::valid($ghsInfo, $this->shopId);
|
|
|
+ }
|
|
|
$where = [
|
|
|
'ghsId' => $ghsId,
|
|
|
'mergeId' => $mergeId,
|
|
|
@@ -1065,7 +1098,7 @@ class PurchaseController extends BaseController
|
|
|
if (empty($respond['list'])) {
|
|
|
util::fail('请选择采购单');
|
|
|
}
|
|
|
- $respond['shop'] = $this->shop->attributes;
|
|
|
+ $respond['shop'] = !empty($this->shop) ? $this->shop->attributes : [];
|
|
|
util::success($respond);
|
|
|
}
|
|
|
|
|
|
@@ -1075,6 +1108,18 @@ class PurchaseController extends BaseController
|
|
|
$get = Yii::$app->request->get();
|
|
|
$id = $get['id'] ?? 0;
|
|
|
$info = PurchaseService::getInfo($id, true, true);
|
|
|
+ if (empty($info)) {
|
|
|
+ util::fail('没有找到采购单');
|
|
|
+ }
|
|
|
+ if (empty($this->shopId)) {
|
|
|
+ $salt = $get['salt'] ?? '';
|
|
|
+ if (empty($salt)) {
|
|
|
+ util::fail('请求参数错误');
|
|
|
+ }
|
|
|
+ if (empty($info['salt']) || $info['salt'] != $salt) {
|
|
|
+ util::fail('没有找到采购单');
|
|
|
+ }
|
|
|
+ }
|
|
|
if (isset($info['mainId']) == false || $info['mainId'] != $this->mainId) {
|
|
|
//不能注释,分享付款功能要用,客户没有登录也能付款
|
|
|
//util::fail('无法访问');
|