StockController.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * User: admin
  4. * Date Time: 2021/5/19 19:31
  5. */
  6. namespace hd\controllers;
  7. use biz\stock\classes\GoodsStockRecordClass;
  8. use bizGhs\stock\classes\StockRecordClass;
  9. use common\components\dateUtil;
  10. use common\components\util;
  11. use Yii;
  12. class StockController extends BaseController
  13. {
  14. //库存明细 linqh 2021.1.26
  15. public function actionDetail()
  16. {
  17. $get = Yii::$app->request->get();
  18. $itemId = $get['itemId']??0;
  19. $where = ['itemId'=>$itemId,'shopId'=>$this->shopId];
  20. $searchTime = $get['searchTime'] ?? '';
  21. if (!empty($searchTime)) {
  22. $startTime = $get['startTime'] ?? '';
  23. $endTime = $get['endTime'] ?? '';
  24. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  25. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  26. }
  27. $list = StockRecordClass::getRecordList($where);
  28. util::success($list);
  29. }
  30. //成品(goods)明细
  31. public function actionGoodsDetail()
  32. {
  33. $get = Yii::$app->request->get();
  34. $goodsId = $get['goodsId']??0;
  35. $where = ['goodsId'=>$goodsId,'mainId'=>$this->mainId];
  36. $searchTime = $get['searchTime'] ?? '';
  37. if (!empty($searchTime)) {
  38. $startTime = $get['startTime'] ?? '';
  39. $endTime = $get['endTime'] ?? '';
  40. $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
  41. $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
  42. }
  43. $list = GoodsStockRecordClass::getRecordList($where);
  44. util::success($list);
  45. }
  46. }