InventoryController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\admin\controllers\erp;
  8. use app\models\Goods;
  9. use app\models\Option;
  10. use app\constants\OptionSetting;
  11. use app\modules\admin\models\erp\InventoryForm;
  12. use app\modules\admin\models\erp\ERP;
  13. class InventoryController extends BaseController
  14. {
  15. public function actionTest()
  16. {
  17. $id = '22528';
  18. $res = InventoryForm::initStoreGoods(84);
  19. // $res = InventoryForm::initGoods(84, $id);
  20. return $this->asJson($res);
  21. }
  22. public function actionInitStoreGoods()
  23. {
  24. $res = InventoryForm::initStoreGoods(get_store_id());
  25. return $this->asJson($res);
  26. }
  27. public function actionInitGoods()
  28. {
  29. $res = InventoryForm::initGoods(get_store_id(), input_params('id'));
  30. return $this->asJson($res);
  31. }
  32. /**
  33. * @return \yii\web\Response
  34. * 获取列表
  35. */
  36. public function actionList()
  37. {
  38. $form = new InventoryForm();
  39. $form->store_id = get_store_id();
  40. $form->attributes = all_params();
  41. $res = $form->search(1, all_params());
  42. return $this->asJson($res);
  43. }
  44. public function actionWarningList()
  45. {
  46. $form = new InventoryForm();
  47. $form->store_id = get_store_id();
  48. $form->attributes = all_params();
  49. $res = $form->warningList(all_params());
  50. return $this->asJson($res);
  51. }
  52. /**
  53. * @return \yii\web\Response
  54. * 保存信息
  55. */
  56. public function actionSaveSupplier()
  57. {
  58. $form = new InventoryForm();
  59. $form->store_id = get_store_id();
  60. $form->attributes = all_params();
  61. $res = $form->saveSupplier();
  62. return $this->asJson($res);
  63. }
  64. public function actionSaveWarningNum()
  65. {
  66. $res = ERP::saveWarningNum(get_store_id(), input_params('warning_num', 0));
  67. return $this->asJson($res);
  68. }
  69. public function actionGetWarningNum()
  70. {
  71. $res = ERP::getWarningNum(get_store_id());
  72. return $this->asJson([
  73. 'code' => 0,
  74. 'data' => $res,
  75. ]);
  76. }
  77. public function actionSaveKey()
  78. {
  79. $form = new InventoryForm();
  80. $form->store_id = get_store_id();
  81. $form->attributes = all_params();
  82. $res = $form->saveKey();
  83. return $this->asJson($res);
  84. }
  85. /**
  86. * @return \yii\web\Response
  87. * 修改状态
  88. */
  89. public function actionDel()
  90. {
  91. $form = new InventoryForm();
  92. $form->store_id = get_store_id();
  93. $form->attributes = all_params();
  94. $res = $form->del(all_params());
  95. return $this->asJson($res);
  96. }
  97. public function actionLogList()
  98. {
  99. $form = new InventoryForm();
  100. $form->store_id = get_store_id();
  101. $form->attributes = all_params();
  102. $res = $form->logList();
  103. return $this->asJson($res);
  104. }
  105. }