PlantCgController.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace hd\controllers;
  3. use bizHd\goods\classes\PlantCgClass;
  4. use bizHd\goods\classes\PlantCgItemClass;
  5. use common\components\util;
  6. use Yii;
  7. class PlantCgController extends BaseController
  8. {
  9. //采购详情 ssh 2020521
  10. public function actionDetail()
  11. {
  12. $get = Yii::$app->request->get();
  13. $id = $get['id'] ?? 0;
  14. $cg = PlantCgClass::getById($id, true);
  15. if ($cg->mainId != $this->mainId) {
  16. util::fail('没有权限');
  17. }
  18. $itemList = PlantCgItemClass::getItemList($cg);
  19. $data = [];
  20. $data['hasDebtPay'] = 0;
  21. $data['balance'] = 0;
  22. $data['info'] = $cg;
  23. $data['itemList'] = $itemList;
  24. util::success($data);
  25. }
  26. //采购记录 ssh 20220521
  27. public function actionList()
  28. {
  29. $get = Yii::$app->request->get();
  30. $where = ['shopId' => $this->shopId];
  31. $status = $get['status'] ?? 0;
  32. if (!empty($status)) {
  33. $where['status'] = $status;
  34. }
  35. $respond = PlantCgClass::getCgList($where);
  36. $respond['shop'] = $this->shop;
  37. util::success($respond);
  38. }
  39. //获取采购详情 ssh 20220508
  40. public function actionGetFullInfo()
  41. {
  42. $id = Yii::$app->request->get('id');
  43. $cg = PlantCgClass::getById($id, true);
  44. PlantCgClass::valid($cg, $this->mainId);
  45. $orderSn = $cg->orderSn ?? '';
  46. $itemList = PlantCgItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
  47. util::success(['info' => $cg, 'itemList' => $itemList]);
  48. }
  49. }