Formula.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\controller\Backend;
  4. use think\Session;
  5. use think\Db;
  6. /**
  7. * 配方管理
  8. *
  9. * @icon fa fa-circle-o
  10. */
  11. class Formula extends Backend
  12. {
  13. /**
  14. * Formula模型对象
  15. * @var \app\admin\model\Formula
  16. */
  17. protected $model = null;
  18. protected $searchFields = "name";
  19. protected $noNeedLogin = ['gyName'];
  20. public function _initialize()
  21. {
  22. parent::_initialize();
  23. $this->model = new \app\admin\model\Formula;
  24. $this->view->assign("examineStatusList", $this->model->getExamineStatusList());
  25. $this->view->assign("statusList", $this->model->getStatusList());
  26. // $this->view->assign("gyNameList", \app\admin\model\GyName::select());
  27. }
  28. /**
  29. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  30. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  31. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  32. */
  33. /**
  34. * 查看
  35. *
  36. * @return string|Json
  37. * @throws \think\Exception
  38. * @throws DbException
  39. */
  40. public function index()
  41. {
  42. //设置过滤方法
  43. $this->request->filter(['strip_tags', 'trim']);
  44. if (false === $this->request->isAjax()) {
  45. return $this->view->fetch();
  46. }
  47. // 获取搜索框的值
  48. $map = [];
  49. $filter=input('filter');
  50. if($filter){
  51. $filter=urldecode($filter);
  52. $filter=json_decode($filter,TRUE);
  53. foreach($filter as $k=>$v){
  54. $map[$k]=['like',"%{$v}%"];
  55. }
  56. }
  57. //如果发送的来源是 Selectpage,则转发到 Selectpage
  58. if ($this->request->request('keyField')) {
  59. return $this->selectpage();
  60. }
  61. [$where, $sort, $order, $offset, $limit] = $this->buildparams();
  62. $user_info = Session::get('admin');
  63. if ($user_info['id'] !== 1){//管理员
  64. $map['company_id'] = $user_info['company_id'];
  65. $map['examine_status'] = 2;
  66. }
  67. if(!empty($map['name'])||!empty($map['material'])){
  68. $sort = 'f.id';
  69. $list = DB::name('formula')
  70. ->where($where)
  71. ->where($map)
  72. ->alias('f')
  73. ->group('f.id')
  74. ->field('f.id,f.name,f.version,f.examine_status,f.create')
  75. ->join('formula_detail fd','fd.pid=f.id','left')
  76. ->order($sort, $order)
  77. ->paginate($limit);
  78. }else{
  79. $list = $this->model
  80. ->where($where)
  81. ->where($map)
  82. ->order($sort, $order)
  83. ->paginate($limit);
  84. }
  85. $result = ['total' => $list->total(), 'rows' => $list->items()];
  86. return json($result);
  87. }
  88. /**
  89. * 添加
  90. *
  91. * @return string
  92. * @throws \think\Exception
  93. */
  94. public function add()
  95. {
  96. if (false === $this->request->isPost()) {
  97. //技术部=>担当人
  98. $jsdd = Db::name('personnel')->where('bid',"=",2)->where('position','=',"jsdd")->order('name desc')->select();
  99. //技术部=>审核人
  100. $jssh = Db::name('personnel')->where('bid',"=",2)->where('position','=',"jssh")->order('name desc')->select();
  101. $this->assign('jsdd',$jsdd);
  102. $this->assign('jssh',$jssh);
  103. return $this->view->fetch();
  104. }
  105. $base = $this->request->post('baseData/a');
  106. $formula = $this->request->post('formulaData/a');
  107. if (empty($base) || empty($formula)){
  108. $this->error('数据不能为空');
  109. }
  110. $params = [];
  111. $params['name'] = $base[0];
  112. $params['no'] = $base[1];
  113. $params['charge_name'] = $base[2];
  114. $params['examine_name'] = $base[3];
  115. $params['remark'] = $base[4];
  116. $params['version'] = $base[5];
  117. $params['date'] = $base[6];
  118. $params['model'] = $base[8];
  119. if ($base[7] !== 99){
  120. $customer= explode(',',$base[7]);
  121. // print_r($base[7]);die;
  122. $customer_id = Db::name('customer')->where('customer_name','in',$customer)->column('id');
  123. $usability = implode(',',$customer_id);
  124. }
  125. $params['usability'] = $usability;
  126. $params['create'] = date('Y-m-d H:i:s');
  127. $user_info = Session::get('admin');
  128. $params['user_id'] = $user_info['id'];
  129. $params['company_id'] = $user_info['company_id'];
  130. $result = false;
  131. Db::startTrans();
  132. try {
  133. $pid = Db::name('formula')->insertGetId($params);
  134. if (!$pid){
  135. Db::rollback();
  136. $this->error('数据未插入,请重新操作');
  137. }
  138. $data = [];
  139. $is_replace = 0;
  140. // $gy_num = 1;
  141. foreach($formula as $key=>$value){
  142. if (strpos($value[0],'/') === false){
  143. $data[$key]['is_replace'] = 0;
  144. }else{
  145. $data[$key]['is_replace'] = 1;
  146. $is_replace = 1;
  147. }
  148. $data[$key]['material'] = $value[0];
  149. $data[$key]['percentage'] = encrypt($value[1]);
  150. $data[$key]['gy_name'] = $value[2];
  151. // $data[$key]['gy_num'] = $gy_num;
  152. $data[$key]['gy_num'] = $value[3];
  153. $data[$key]['pid'] = $pid;
  154. $data[$key]['version'] = $params['version'];
  155. $data[$key]['create'] = $params['create'];
  156. // if(!$value[0]&&!$value[1]&&$value[2]){
  157. // $gy_num++;
  158. // }
  159. }
  160. $result = Db::name('formula_detail')->insertAll($data);
  161. //有替代料的话 查出所有替代料 然后分解 插入到数据库 2022年9月19日14:20:37 替代料功能改变
  162. // if ($is_replace == 1){
  163. // $replace = Db::name('formula_detail')->where('pid',$pid)->where('is_replace',1)->field('id,material')->select();
  164. // $replaceData = [];
  165. // $j = 0;
  166. // foreach ($replace as $k=>$v){
  167. // $material = explode('/',$v['material']);
  168. // for ($i=0;$i<count($material);$i++){
  169. // $replaceData[$j]['fid'] = $v['id'];
  170. // $replaceData[$j]['material'] = $material[$i];
  171. // $replaceData[$j]['create'] = date('Y-m-d H:i:s');
  172. // $j++;
  173. // }
  174. // }
  175. // $result = Db::name('formula_replace')->insertAll($replaceData);
  176. // }
  177. Db::commit();
  178. } catch (Exception $e) {
  179. Db::rollback();
  180. $this->error($e->getMessage());
  181. }
  182. if ($result === false) {
  183. $this->error(__('No rows were inserted'));
  184. }
  185. $this->success();
  186. }
  187. /**
  188. * 编辑
  189. *
  190. * @param $ids
  191. * @return string
  192. * @throws DbException
  193. * @throws \think\Exception
  194. */
  195. public function edit($ids = null)
  196. {
  197. if (!$ids) {
  198. $this->error(__('No Results were found'));
  199. }
  200. if (false === $this->request->isPost()) {
  201. $list = Db::name('formula')->where('id',$ids)->find();
  202. //可用性,对应客户名称
  203. if ($list['usability'] != 99){
  204. $customer = explode(',',$list['usability']);
  205. $name = Db::name('customer')->where('id','in',$customer)->column('customer_name');
  206. }
  207. $list['gyinfo'] = Db::name('formula_detail')->where('pid',$ids)->where('version',$list['version'])->field('material,percentage,gy_name,gy_num')->select();
  208. foreach ($list['gyinfo'] as $key=>$value){
  209. $list['gyinfo'][$key]['percentage'] = decode($value['percentage']);
  210. }
  211. // dump($list);die;
  212. $this->view->assign('ids',$ids);
  213. $this->view->assign('name',$name);
  214. $this->view->assign('row', $list);
  215. return $this->view->fetch();
  216. }
  217. /**
  218. * 厂家变更?
  219. * 原材料变更?
  220. * 百分比变更? ->工艺信息变更生成新配方
  221. * 工艺变更?
  222. * $change 0:未更改工艺信息 1:原材料更改 2:百分比更改 3:操作工艺更改 4:增加或减少工艺信息
  223. */
  224. $base = $this->request->post('baseData/a');
  225. $formula = $this->request->post('formulaData/a');
  226. if (empty($base) || empty($formula)){
  227. $this->error('数据不能为空');
  228. }
  229. $version = Db::name('formula')->where('name',$base[0])->order('id desc')->value('version');
  230. $version = substr($version,1);//获取当前最新版本号,后续看工艺情况是否更改
  231. //基础数据
  232. $params = [];
  233. $params['name'] = $base[0];
  234. $params['no'] = $base[1];
  235. $params['charge_name'] = $base[2];
  236. $params['examine_name'] = $base[3];
  237. $params['remark'] = $base[4];
  238. $params['date'] = $base[6];
  239. $params['model'] = $base[8];
  240. //配方对应客户id(可用性)
  241. if ($base[7] !== 99){
  242. $customer= explode(',',$base[7]);
  243. $customer_id = Db::name('customer')->where('customer_name','in',$customer)->column('id');
  244. $usability = implode(',',$customer_id);
  245. }
  246. $params['usability'] = $usability;
  247. $params['create'] = date('Y-m-d H:i:s');
  248. $user_info = Session::get('admin');
  249. $params['user_id'] = $user_info['id'];
  250. $params['company_id'] = $user_info['company_id'];
  251. $params['update'] = date('Y-m-d H:i:s');
  252. //数据库的工艺数据
  253. $gy_data = Db::name('formula_detail')->where('pid',$ids)->field('id,material,percentage,gy_name')->order('id asc')->select();
  254. //提交的工艺数据
  255. $data = [];
  256. $change = 0;
  257. $materialChange = 0; //原材料变更
  258. $percentageChange = 0; //百分比变更
  259. $gy_nameChange = 0; //工艺信息变更
  260. //总工艺已更改,版本号X位直接增加1
  261. if (count($gy_data) != count($formula)){
  262. $change = 1;
  263. }
  264. foreach($formula as $key=>$value){
  265. foreach ($gy_data as $k=>$v){
  266. //比对同一行原材料 百分比 工艺信息
  267. if ($key == $k){
  268. if ($value[0] != $gy_data[$k]['material']){
  269. $materialChange = 1;
  270. }
  271. if ($value[1] != $gy_data[$k]['percentage']){
  272. $percentageChange = 1;
  273. }
  274. if($value[2] != $gy_data[$k]['gy_name']){
  275. $gy_nameChange = 1;
  276. }
  277. }
  278. }
  279. }
  280. //更改版本号
  281. if ($change === 1){
  282. $version = intval($version) + 1;
  283. }else{
  284. if ($materialChange === 1){
  285. $version = intval($version) + 1;
  286. }else{
  287. if ($percentageChange === 1 || $gy_nameChange === 1){
  288. $version = $version + 0.1;
  289. }
  290. }
  291. }
  292. if (is_int($version)){
  293. $version = $version.'.0';
  294. }
  295. //根据版本号的变化来判断工艺有没有变化
  296. if ($version == substr($base[5],1)){
  297. $isChange = false;
  298. }else{
  299. $isChange = true;
  300. }
  301. $params['version'] = 'v'.$version;
  302. $result = true;
  303. Db::startTrans();
  304. try {
  305. if ($isChange === true){
  306. $ids = Db::name('formula')->insertGetId($params);
  307. }else{
  308. Db::name('formula')->where('id',$ids)->update($params);
  309. }
  310. //新工艺信息
  311. $is_replace = 0;
  312. for($i=0;$i<count($formula);$i++){
  313. if (strpos($formula[$i][0],'/') === false){
  314. $data[$i]['is_replace'] = 0;
  315. }else{
  316. $data[$i]['is_replace'] = 1;
  317. $is_replace = 1;
  318. }
  319. $data[$i]['material'] = $formula[$i][0];
  320. $data[$i]['percentage'] = encrypt($formula[$i][1]);
  321. $data[$i]['gy_name'] = $formula[$i][2];
  322. $data[$i]['gy_num'] = $formula[$i][3];
  323. // $data[$i]['gy_num'] = $gy_num;
  324. $data[$i]['pid'] = $ids;
  325. $data[$i]['version'] = 'v'.$version;
  326. $data[$i]['create'] = date('Y-m-d H:i:s');
  327. }
  328. if ($isChange === true){
  329. Db::name('formula_detail')->insertAll($data);
  330. }
  331. //有替代料的话 查出所有替代料 然后分解 插入到数据库 //2022年9月19日14:19:09 替代料更改
  332. // if ($is_replace == 1 && ($materialChange == 1 || $change == 1)){
  333. // $replace = Db::name('formula_detail')->where('pid',$ids)->where('is_replace',1)->field('id,material')->select();
  334. // $replaceData = [];
  335. // $j = 0;
  336. // foreach ($replace as $k=>$v){
  337. // $material = explode('/',$v['material']);
  338. // for ($i=0;$i<count($material);$i++){
  339. // $replaceData[$j]['fid'] = $v['id'];
  340. // $replaceData[$j]['material'] = $material[$i];
  341. // $replaceData[$j]['create'] = date('Y-m-d H:i:s');
  342. // $j++;
  343. // }
  344. // }
  345. // $result = Db::name('formula_replace')->insertAll($replaceData);
  346. // }
  347. Db::commit();
  348. } catch (Exception $e) {
  349. Db::rollback();
  350. $this->error($e->getMessage());
  351. }
  352. if (false === $result) {
  353. $this->error(__('No rows were updated'));
  354. }
  355. $this->success();
  356. }
  357. //生成作业单
  358. public function task(){
  359. // $ceshi = Db::name('formula_detail')->where('id','>',52459)->limit(10000)->select();
  360. // foreach ($ceshi as $key=>$value){
  361. // $ceshi[$key]['percentage'] = encrypt($value['percentage']);
  362. // }
  363. // Db::name('formula_detail_c')->insertAll($ceshi);
  364. // print_r('-------------------------------');
  365. // die;
  366. $ids = input('ids');
  367. if (!$ids) {
  368. $this->error(__('No Results were found'));
  369. }
  370. if (false === $this->request->isPost()) {
  371. //生产部=>开票人
  372. $sckp = Db::name('personnel')->where('bid',"=",3)->where('position','=',"sckp")->order('name desc')->select();
  373. //生产部=>审核人
  374. $scsh = Db::name('personnel')->where('bid',"=",3)->where('position','=',"scsh")->order('name desc')->select();
  375. $this->assign('sckp',$sckp);
  376. $this->assign('scsh',$scsh);
  377. //批次号顺序新增
  378. $tastbach = Db::name('task')->order('bach desc')->find();
  379. $bach = $tastbach['bach'] +1;
  380. $this->view->assign('bach',$bach);
  381. $list = Db::name('formula')->where('id',$ids)->find();
  382. $list['gyinfo'] = Db::name('formula_detail')->where('pid',$ids)->where('version',$list['version'])->field('id,material,percentage,gy_name,gy_num')->select();
  383. foreach ($list['gyinfo'] as $key=>$value){
  384. $list['gyinfo'][$key]['percentage'] = decode($value['percentage']);
  385. }
  386. //新增关联订单
  387. $order = Db::name('order')->where('status','neq',3)->field('id,customer,product,number,completed')->select();
  388. $uncompleted_order = array();
  389. if (!empty($order)){
  390. foreach($order as $k=>$v){
  391. $uncompleted_order[$k]['id'] = $v['id'];
  392. if (empty($v['completed'])){
  393. $completed = 0;
  394. }else{
  395. $completed = $v['completed'];
  396. }
  397. $uncompleted_order[$k]['str'] = $v['id'].'、'.$v['customer'].'-'.$v['product'].'-'.'总数量('.$v['number'].'kg)'.'-' .'已完成('.$completed.'kg)';
  398. }
  399. }
  400. $this->view->assign('ids',$ids);
  401. $this->view->assign('order',$uncompleted_order);
  402. $this->view->assign('machineList',\app\admin\model\Machine::select());
  403. $this->view->assign('row', $list);
  404. return $this->view->fetch();
  405. }
  406. $base = $this->request->post('baseData/a');
  407. // print_r($base);die;
  408. if (empty($base)){
  409. $this->error('数据不能为空');
  410. }
  411. //基础数据
  412. $params = [];
  413. $params['fid'] = $base[0];
  414. $params['name'] = $base[1];
  415. $params['bach'] = $base[2];
  416. $params['drawer_name'] = $base[3];
  417. $params['examine_name'] = $base[4];
  418. $params['number'] = $base[5];
  419. $params['remark'] = $base[6];
  420. $params['machine'] = $base[7];
  421. $params['oid'] = $base[8];
  422. $params['create'] = date('Y-m-d H:i:s');
  423. $result = false;
  424. Db::startTrans();
  425. try {
  426. $result = Db::name('task')->insert($params);
  427. //更改订单已完成数量,修改订单状态
  428. $order_info = Db::name('order')->where('id',$params['oid'])->find();
  429. if (empty($order_info['completed'])){
  430. $new_completed = $params['number'];
  431. $order_status = 2;//生产中
  432. Db::name('order')->where('id',$params['oid'])->setField('status',2);
  433. }else{
  434. $new_completed = $params['number'] + $order_info['completed'];
  435. }
  436. Db::name('order')->where('id',$params['oid'])->setField('completed',$new_completed);
  437. Db::commit();
  438. } catch (Exception $e) {
  439. Db::rollback();
  440. $this->error($e->getMessage());
  441. }
  442. if (false === $result) {
  443. $this->error(__('No rows were updated'));
  444. }
  445. $this->success();
  446. }
  447. //配方审核列表
  448. public function examine(){
  449. //设置过滤方法
  450. $this->request->filter(['strip_tags', 'trim']);
  451. if (false === $this->request->isAjax()) {
  452. return $this->view->fetch();
  453. }
  454. //如果发送的来源是 Selectpage,则转发到 Selectpage
  455. if ($this->request->request('keyField')) {
  456. return $this->selectpage();
  457. }
  458. [$where, $sort, $order, $offset, $limit] = $this->buildparams();
  459. $user_info = Session::get('admin');
  460. $map = [];
  461. $map['examine_status'] = 1;
  462. if ($user_info['id'] !== 1){
  463. $map['company_id'] = $user_info['company_id'];
  464. }
  465. $list = $this->model
  466. ->where($where)
  467. ->where($map)
  468. ->order($sort, $order)
  469. ->paginate($limit);
  470. $result = ['total' => $list->total(), 'rows' => $list->items()];
  471. return json($result);
  472. }
  473. //审核操作
  474. public function status($ids=null){
  475. if (!$ids) {
  476. $this->error(__('No Results were found'));
  477. }
  478. if (false === $this->request->isPost()) {
  479. $list = Db::name('formula')->where('id',$ids)->find();
  480. //可用性,对应客户名称
  481. if ($list['usability'] != 99){
  482. $customer = explode(',',$list['usability']);
  483. $name = Db::name('customer')->where('id','in',$customer)->column('customer_name');
  484. }
  485. $list['gyinfo'] = Db::name('formula_detail')->where('pid',$ids)->where('version',$list['version'])->field('material,percentage,gy_name,gy_num')->select();
  486. foreach ($list['gyinfo'] as $key=>$value){
  487. $list['gyinfo'][$key]['percentage'] = decode($value['percentage']);
  488. }
  489. $this->view->assign('ids',$ids);
  490. $this->view->assign('name',$name);
  491. $this->view->assign('row', $list);
  492. return $this->view->fetch();
  493. }
  494. $status = $this->request->post('status');
  495. if (!isset($status) || !isset($ids)){
  496. $this->error('审核失败');
  497. }
  498. $params = [];
  499. $params['examine_status'] = $status;
  500. $params['update'] = date('Y-m-d H:i:s');
  501. $result = false;
  502. Db::startTrans();
  503. try {
  504. $list = Db::name('formula')->where('id',$ids)->find();
  505. if ($list['version'] == 'v0.1'){
  506. Db::name('formula')->where('id',$ids)->setField('version','v1.0');
  507. Db::name('formula_detail')->where('pid',$ids)->setField('version','v1.0');
  508. }
  509. $result = Db::name('formula')->where('id',$ids)->update($params);
  510. Db::commit();
  511. } catch (Exception $e) {
  512. Db::rollback();
  513. $this->error($e->getMessage());
  514. }
  515. if ($result){
  516. $this->success('更新成功');
  517. }else{
  518. $this->error('审核失败');
  519. }
  520. }
  521. //下拉选择获取客户列表
  522. public function getCustomer(){
  523. $user_info = Session::get('admin');
  524. $where = [];
  525. if ($user_info['id'] !== 1){
  526. $where['company_id'] =$user_info['company_id'];
  527. }
  528. $row = Db::name('customer')->where($where)->field('id,customer_name')->select();
  529. $result = ['total' => count($row), 'rows' => $row];
  530. return json($result);
  531. }
  532. //获取生产单应加量
  533. public function getNumber(){
  534. $params = input('');
  535. if ($params['ids'] == '' || $params['number'] == '' || !is_numeric($params['number'])){
  536. return array('status'=>0,'msg'=>'请求参数错误');
  537. }
  538. $list = Db::name('formula')->where('id',$params['ids'])->find();
  539. $gyinfo= Db::name('formula_detail')->where('pid',$params['ids'])->where('version',$list['version'])->field('id,material,percentage,gy_name,gy_num')->select();
  540. if (empty($gyinfo)){
  541. return array('status'=>0,'msg'=>'数据错误');
  542. }
  543. $total = Db::name('formula_detail')->where('pid',$params['ids'])->where('version',$list['version'])->column('percentage');
  544. if (empty($total)){
  545. return array('status'=>0,'msg'=>'数据错误');
  546. }
  547. foreach ($total as $k=>$v){
  548. $total[$k] = decode($v);
  549. }
  550. $num = array_sum($total);
  551. foreach ($gyinfo as $key=>$value){
  552. if($gyinfo[$key]['gy_name'] == null){//
  553. $gyinfo[$key]['gy_name'] = '';//
  554. }//
  555. $gyinfo[$key]['num'] = '';
  556. $gyinfo[$key]['percentage'] = decode($value['percentage']);
  557. if (!empty($value['percentage'])){
  558. // $gyinfo[$key]['num'] = number_format($gyinfo[$key]['percentage'] / $num * $params['number'],3);
  559. $number = ceil($gyinfo[$key]['percentage'] / $num * $params['number'] *1000);
  560. $gyinfo[$key]['num'] = number_format($number/1000,3);
  561. }
  562. }
  563. $date = date('Y/m/d');
  564. return array('status'=>1,'data'=>$gyinfo,'formula_no'=>$list['formula_no'],'date'=>$date);
  565. }
  566. //获取工艺说明
  567. public function gyName(){
  568. $params = input('gy_name');
  569. // print_r($params);die;
  570. if ($params){
  571. $list = Db::name('formula_detail')->where('gy_name','like','%'.$params.'%')->field('id,gy_name')->limit(20)->select();
  572. }else{
  573. $list = Db::name('formula_detail')->where('gy_name','neq','')->field('id,gy_name')->limit(20)->select();
  574. }
  575. $total = count($list);
  576. $result = ['total'=>$total,'rows'=>$list];
  577. // return array('status'=>1,'rows'=>$list);
  578. return json($result);
  579. }
  580. }