123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- namespace app\admin\controller;
- use think\facade\Db;
- //台账
- class StandingBook extends Base
- {
- //台账列表
- public function getList()
- {
- $param = $this->request->only([
- 'start_date' => '',
- 'end_date' => '',
- 'standBookNo' => '',
- 'projectNo' => '',
- 'infoNo' => '',
- 'bargainNo' => '',
- 'bk_code' => '',
- 'orderCode' => '',
- 'cgdNo' => '',
- 'spuCode' => '',
- 'skuCode' => '',
- 'supplierNo' => '',
- 'companyNo' => '',
- 'customer_code' => '',
- 'page' => 1,
- 'size' => 15
- ], 'post', 'trim');
- $where = [];
- if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
- if ($param['standBookNo'] != '') $where[] = ['standBookNo', 'like', '%' . $param['standBookNo'] . '%'];
- if ($param['projectNo'] != '') $where[] = ['projectNo', 'like', '%' . $param['projectNo'] . '%'];
- if ($param['infoNo'] != '') $where[] = ['infoNo', 'like', '%' . $param['infoNo'] . '%'];
- if ($param['bargainNo'] != '') $where[] = ['bargainNo', 'like', '%' . $param['bargainNo'] . '%'];
- if ($param['bk_code'] != '') $where[] = ['bk_code', 'like', '%' . $param['bk_code'] . '%'];
- if ($param['orderCode'] != '') $where[] = ['orderCode', 'like', '%' . $param['orderCode'] . '%'];
- if ($param['cgdNo'] != '') $where[] = ['cgdNo', 'like', '%' . $param['cgdNo'] . '%'];
- if ($param['spuCode'] != '') $where[] = ['spuCode', 'like', '%' . $param['spuCode'] . '%'];
- if ($param['skuCode'] != '') $where[] = ['skuCode', 'like', '%' . $param['skuCode'] . '%'];
- if ($param['supplierNo'] != '') $where[] = ['supplierNo', 'like', '%' . $param['supplierNo'] . '%'];
- if ($param['companyNo'] != '') $where[] = ['companyNo', 'like', '%' . $param['companyNo'] . '%'];
- if ($param['customer_code'] != '') $where[] = ['customer_code', 'like', '%' . $param['customer_code'] . '%'];
- $count = Db::name('standing_book')
- ->where($where)
- ->count('id');
- $list = Db::name('standing_book')
- ->where($where)
- ->order('addtime', 'desc')
- ->page($param['page'], $param['size'])
- ->withAttr('outCode', function ($val) {
- //有可能第一个是,开头
- return trim($val, ',');
- })
- ->withAttr('returnCode', function ($val) {
- return trim($val, ',');
- })
- ->withAttr('thNo', function ($val) {
- return trim($val, ',');
- })
- ->withAttr('returnGoodCode', function ($val) {
- return trim($val, ',');
- })
- ->withAttr('wsm_in_code', function ($val) {
- return trim($val, ',');
- })
- ->withAttr('cgdReturnCode', function ($val) {
- return trim($val, ',');
- })
- ->select()
- ->toArray();
- return app_show(0, "获取成功", ['list' => $list, 'count' => $count]);
- }
- //台账详情
- public function getDetail()
- {
- $id = $this->request->post('id/d', 0, 'trim');
- $res = Db::name('standing_book')
- ->where('id', $id)
- ->withAttr('outCode', function ($val) {
- //有可能第一个是,开头
- return trim($val, ',');
- })
- ->withAttr('returnCode', function ($val) {
- return trim($val, ',');
- })
- ->withAttr('thNo', function ($val) {
- return trim($val, ',');
- })
- ->withAttr('returnGoodCode', function ($val) {
- return trim($val, ',');
- })
- ->withAttr('wsm_in_code', function ($val) {
- return trim($val, ',');
- })
- ->withAttr('cgdReturnCode', function ($val) {
- return trim($val, ',');
- })
- ->find();
- return app_show(0, '请求成功', $res);
- }
- }
|