Whlabeltransport.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Whlabeltransport extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->_model('Model_whlabel','whlabel');
  6. $this->load->_model('Model_warehouse','warehouse');
  7. $this->load->_model('Model_excel','excel');
  8. $this->load->_model('Model_whlabeltransport','whlabeltransport');
  9. }
  10. //定义方法的调用规则 获取URI第二段值
  11. public function _remap($arg,$arg_array)
  12. {
  13. if($arg == 'add')//添加
  14. {
  15. $this->_add();
  16. }
  17. else if($arg == 'edit')//修改
  18. {
  19. $this->_edit($arg_array);
  20. }
  21. else if($arg == 'del')//修改
  22. {
  23. $this->_del();
  24. }
  25. else if($arg == 'zj')//修改
  26. {
  27. $this->_zj();
  28. }
  29. else if($arg == 'list')//修改
  30. {
  31. $this->_list();
  32. }
  33. else if($arg == 'presetou')//修改
  34. {
  35. $this->_presetout($arg_array);
  36. }
  37. else if($arg == 'excel')
  38. {
  39. $this->_excel();
  40. }
  41. else if($arg == 'excelzh')
  42. {
  43. $this->_excelzh();//整合数据
  44. }
  45. else
  46. {
  47. $this->_index();
  48. }
  49. }
  50. //管理
  51. public function _index()
  52. {
  53. $post = $this->input->post(NULL, TRUE);
  54. if(isset($post['page']))
  55. {
  56. $page = $this->input->post('page',true);
  57. $perpage = $this->input->post('perpage',true);
  58. $warehouse = $this->input->post('warehouse',true);
  59. $sku = $this->input->post('sku',true);
  60. $text = $this->input->post('text',true);
  61. $cz = $this->input->post('cz',true);
  62. $xztime = $this->input->post('xztime',true);
  63. $timetk = $this->input->post('timetk',true);
  64. $timetj = $this->input->post('timetj',true);
  65. $timetk = strtotime($timetk);
  66. $timetj = strtotime($timetj);
  67. $where = "1=1 ";
  68. if($warehouse)
  69. {
  70. $where .= " and warehouse = '$warehouse'";
  71. }
  72. if($sku)
  73. {
  74. $where .= " and sku = '$sku'";
  75. }
  76. if($text)
  77. {
  78. $where .= " and text like '%$text%'";
  79. }
  80. if($cz != '')
  81. {
  82. $where .= " and cz = '$cz'";
  83. }
  84. if($timetk && $timetj)
  85. {
  86. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  87. }
  88. //数据排序
  89. $order_str = $xztime." desc";
  90. if(empty($page))
  91. {
  92. $start = 0;
  93. $perpage = 1;
  94. }
  95. else
  96. {
  97. $start = ($page - 1)*$perpage;
  98. }
  99. $info_list = $this->whlabeltransport->find_all($where,'id,warehouse,sku,title,num,enter,stime,time,text,cz',$order_str,$start,$perpage);
  100. foreach ($info_list as $key=>$value)
  101. {
  102. $warehouse = $this->warehouse->read($value['warehouse']);
  103. $info_list[$key]['warehouse'] = $warehouse['title'];
  104. $info_list[$key]['enter'] = date('Y-m-d H:i:s',$value['enter']);
  105. $info_list[$key]['stime'] = date('Y-m-d',$value['stime']);
  106. if($value['time'] > 0)
  107. {
  108. $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
  109. }
  110. else
  111. {
  112. $info_list[$key]['time'] = "<p class='wc'><p>";
  113. }
  114. if($value['cz'] == '0')
  115. {
  116. $info_list[$key]['cz'] = "<p class='cz'><span class='ztwc' data-id='".$value['id']."'>点击完成</span><p>";
  117. }
  118. else if($value['cz'] == '1')
  119. {
  120. $info_list[$key]['cz'] = "<p class='cz'><font>已完成</font><p>";
  121. }
  122. }
  123. $total = $this->whlabeltransport->find_count($where);
  124. $pagenum = ceil($total/$perpage);
  125. $over = $total-($start+$perpage);
  126. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  127. echo json_encode($rows);exit;
  128. }
  129. $this->_Template('whlabeltransport',$this->data);
  130. }
  131. //添加
  132. public function _add()
  133. {
  134. $dir = '/data/excel/'.date('Ymd',time()).'/';
  135. $config['upload_path'] = '.'.$dir ;
  136. $config['file_name'] = date('Ymd_His_',time()).rand(1000,9999);
  137. $config['allowed_types'] = 'xls|xlsx|csv';
  138. $config['max_size'] = 10240;
  139. $this->load->library('upload', $config);
  140. $this->upload->initialize($config);
  141. if ($this->upload->do_upload('userfile'))
  142. {
  143. $full_path = $dir.$this->upload->data('file_name');
  144. $fileName = '.' . $full_path;
  145. if (!file_exists($fileName))
  146. {
  147. echo json_encode(array('msg'=>"上传失败,请重试",'success'=>false));exit;
  148. }
  149. else
  150. {
  151. libxml_use_internal_errors(true);
  152. require_once "./data/excel/PHPExcel/IOFactory.php";
  153. $phpExcel = PHPExcel_IOFactory::load($fileName);// 载入当前文件
  154. $phpExcel->setActiveSheetIndex(0);// 设置为默认表
  155. $sheetCount = $phpExcel->getSheetCount();// 获取表格数量
  156. $row = $phpExcel->getActiveSheet()->getHighestRow();// 获取行数
  157. $column = $phpExcel->getActiveSheet()->getHighestColumn();// 获取列数
  158. ++$column;//如果列数大于26行
  159. $list = array();
  160. for ($i = 2; $i <= $row; $i++) // 行数循环
  161. {
  162. $data = array();
  163. for ($c = 'A'; $c != $column; $c++) // 列数循环
  164. {
  165. $data[] = $phpExcel->getActiveSheet()->getCell($c . $i)->getValue();
  166. }
  167. $list[] = $data;
  168. }
  169. }
  170. $i = 0;$j = 0;$ed = array();
  171. foreach ($list as $key=>$value)
  172. {
  173. $time = time();
  174. if($value['0'] == "")
  175. {
  176. continue;
  177. }
  178. $warehouse = $this->warehouse->get_title($value['0']);
  179. //$d = $this->whlabel->get_sku($value['1']);//针对各个仓库
  180. $d = $this->whlabel->get_warehousesku(5,$value['1']);//针对各个仓库
  181. if($value['2'] =='' || $value['2'] < 1)
  182. {
  183. continue;
  184. }
  185. if(!$d)//如果没有这个SKU
  186. {
  187. $ed[] = array($value['1'].'-库存中不存在此SKU');
  188. $j++;
  189. continue;
  190. }
  191. if(!isset($warehouse['id']))
  192. {
  193. $ed[] = array($value['1'].'-仓库名错误!');
  194. $j++;
  195. continue;
  196. }
  197. if($value['3'] == '')
  198. {
  199. $ed[] = array($value['1'].'-没有填写预达日期!');
  200. $j++;
  201. continue;
  202. }
  203. $post['sku'] = $value['1'];
  204. $post['num'] = $value['2'];//数量
  205. $post['stime'] = strtotime($value['3']);//预计到达日期
  206. $post['text'] = $value['4'];//备注
  207. $post['enter'] = $time;//添加时间
  208. $post['shop'] = $d['shop'];
  209. $post['warehouse'] = $warehouse['id'];
  210. $post['purchase'] = $d['purchase'];
  211. $post['title'] = $d['title'];
  212. $post['number'] = $d['number'];
  213. $post['features'] = $d['features'];
  214. $post['retreatwarehouse'] = $d['retreatwarehouse'];
  215. $this->whlabeltransport->insert($post);
  216. }
  217. if($j > 0)
  218. {
  219. $tt = date('Ymd',time());
  220. $title = '导入错误信息-'.$tt;
  221. $titlename = "<table border=1><tr><td>错误详情</td></tr></table>";
  222. $tail = "\n";
  223. $filename = $title.".xls";
  224. $ecl = $this->excel->get_fz3($ed,$titlename,$filename,$tail);
  225. $dir = '/data/excel/'.$time.'/';
  226. $file_name = 'error_'.$time.rand(1000,9999);
  227. if(!is_dir('.'.$dir))mkdir('.'.$dir,0777);
  228. $myfile = fopen(".".$dir.$file_name.".xls", "w") or die();
  229. fwrite($myfile,$ecl);
  230. fclose($myfile);
  231. $error = $dir.$file_name.'.xls';
  232. echo json_encode(array('msg'=>'导入成功,'.$j.'条异常,','error'=>$error,'success'=>true));exit;
  233. }
  234. else
  235. {
  236. echo json_encode(array('msg'=>'导入成功!','error'=>1,'success'=>true));exit;
  237. }
  238. }
  239. }
  240. //修改
  241. public function _edit($arg_array)
  242. {
  243. $post = $this->input->post(NULL, TRUE);
  244. if(isset($post['id']))
  245. {
  246. $id = $this->input->post('id',true);
  247. $data = $this->whlabeltransport->read($id);
  248. if($data['cz'] == '1')
  249. {
  250. echo json_encode(array('msg'=>'已完成的数据无法修改!','success'=>false));exit;
  251. }
  252. $post['num'] = $this->input->post('num',true);
  253. $post['text'] = $this->input->post('text',true);
  254. $stime = $this->input->post('stime',true);
  255. $post['stime'] = strtotime($stime);
  256. $post['edit'] = time();
  257. if($this->whlabeltransport->save($post,$id))
  258. {
  259. echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
  260. }
  261. else
  262. {
  263. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  264. }
  265. }
  266. $arg_array = $arg_array[0];
  267. $whlabeltransport = $this->whlabeltransport->read($arg_array);
  268. $this->data['whlabeltransport'] = $whlabeltransport;
  269. $this->_Template('whlabeltransport_edit',$this->data);
  270. }
  271. public function _zj()
  272. {
  273. $post = $this->input->post(NULL, TRUE);
  274. if(isset($post['id']))
  275. {
  276. $id = $this->input->post('id',true);
  277. $data = $this->whlabeltransport->read($id);
  278. if($data['cz'] == '0')
  279. {
  280. $list = array();$num = "";$title = "";$features = "";
  281. $order = $this->input->post('order',true);
  282. $shop = $this->input->post('shop',true);
  283. $label['shop'] = $data['shop'];
  284. $label['sku'] = $data['sku'];
  285. $label['warehouse'] = $data['warehouse'];
  286. $label['purchase'] = $data['purchase'];
  287. $label['retreatwarehouse'] = $data['retreatwarehouse'];
  288. $label['state'] = 0;
  289. $time = time();
  290. $label['title'] = $data['title'];
  291. $label['number'] = $data['number'];
  292. $label['features'] = $data['features'];
  293. $label['enter'] = $time;
  294. $label['time'] = $time;//操作时间
  295. if($label['warehouse'] == '5')
  296. {
  297. $yza = $this->whlabel->find_all("sku = '".$label['sku']."' and warehouse = '".$label['warehouse']."'",'*','id desc');
  298. if($yza)
  299. {
  300. if($label['features'] != $yza[0]['features'])
  301. {
  302. echo json_encode(array('msg'=>'此SKU的产品信息和现有不一致!- 1','success'=>false));exit;
  303. }
  304. }
  305. /**
  306. $yzb = $this->whlabel->find_all("features = '".$label['features']."' and warehouse = '".$label['warehouse']."'",'*','id desc');
  307. if($yzb)
  308. {
  309. if($label['sku'] != $yzb[0]['sku'])
  310. {
  311. echo json_encode(array('msg'=>'此产品信息的SKU和现有不一致! - 2','success'=>false));exit;
  312. }
  313. }
  314. **/
  315. }
  316. $this->db->trans_begin();
  317. for($i=0;$i<$data['num'];$i++)
  318. {
  319. $label['label'] = time().rand(100,999).$i;//产品标签 辨别各个产品,暂不使用
  320. $label['cs'] = $id;//前期增加这个是在途库存添加的数据
  321. $this->whlabel->insert($label);
  322. }
  323. $this->whlabeltransport->save(array('time'=>$time,'cz'=>1),$data['id']);
  324. if ($this->db->trans_status() === TRUE)
  325. {
  326. $this->db->trans_commit();
  327. echo json_encode(array('msg'=>'入库成功!','id'=>$id,'time'=>date('Y-m-d H:i:s',$time),'success'=>true));exit;
  328. }
  329. else
  330. {
  331. $this->db->trans_rollback();
  332. echo json_encode(array('msg'=>'入库失败,请重试!','success'=>false));exit;
  333. }
  334. }
  335. else
  336. {
  337. echo json_encode(array('msg'=>'错误!已操作入库','success'=>false));exit;
  338. }
  339. }
  340. }
  341. //导出模板
  342. public function _presetout()
  343. {
  344. if(isset($_GET['excel']))
  345. {
  346. $where = "sku != 'Preset'";
  347. //数据排序
  348. $order_str = "id desc";
  349. if(empty($page))
  350. {
  351. $start = 0;
  352. $perpage = 1;
  353. }
  354. else
  355. {
  356. $start = ($page - 1)*$perpage;
  357. }
  358. $warehouse = $this->input->get('warehouse',true);
  359. if($warehouse)
  360. {
  361. $where .= " and warehouse = '".$warehouse."'";
  362. }
  363. //取得信息列表
  364. $info_list = $this->whlabel->find_pc($where,'warehouse,sku','*');
  365. $rows = array();$list = array();
  366. foreach ($info_list as $value)
  367. {
  368. $warehouse = $this->warehouse->read($value['warehouse']);
  369. $number = $value['number'];$ftime = time()-15*24*3600;
  370. $list[] = array($warehouse['title'],$value['sku'],'0','','');
  371. }
  372. $title = "在途模板";
  373. $titlename = "<table border=1>
  374. <tr align='center'>
  375. <td>仓库</td>
  376. <td>SKU</td>
  377. <td>数量</td>
  378. <td>预达日期(格式:2022-01-01)</td>
  379. <td>备注</td>
  380. </tr>
  381. </table>";
  382. $filename = $title.".xls";
  383. $tail = "";
  384. $this->excel->get_fz2($list,$titlename,$filename,$tail);
  385. }
  386. }
  387. public function _excel()
  388. {
  389. if(isset($_GET['excel']))
  390. {
  391. $warehouse = $this->input->get('warehouse',true);
  392. $sku = $this->input->get('sku',true);
  393. $cz = $this->input->get('cz',true);
  394. $text = $this->input->post('text',true);
  395. $xztime = $this->input->get('xztime',true);
  396. $timetk = $this->input->get('timetk',true);
  397. $timetj = $this->input->get('timetj',true);
  398. $timetk = strtotime($timetk);
  399. $timetj = strtotime($timetj);
  400. $where = "1=1 ";
  401. if($warehouse)
  402. {
  403. $where .= " and warehouse = '$warehouse'";
  404. }
  405. if($sku)
  406. {
  407. $where .= " and sku = '$sku'";
  408. }
  409. if($text)
  410. {
  411. $where .= " and text like '%$text%'";
  412. }
  413. if($cz != '')
  414. {
  415. $where .= " and cz = '$cz'";
  416. }
  417. if($timetk && $timetj)
  418. {
  419. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  420. }
  421. //数据排序
  422. $order_str = $xztime." desc";
  423. //取得信息列表
  424. $info_list = $this->whlabeltransport->find_all($where,'warehouse,sku,title,num,enter,stime,time,text');
  425. foreach ($info_list as $key=>$value)
  426. {
  427. $warehouse = $this->warehouse->read($value['warehouse']);
  428. $info_list[$key]['warehouse'] = $warehouse['title'];
  429. $info_list[$key]['enter'] = date('Y-m-d H:i:s',$value['enter']);
  430. $info_list[$key]['stime'] = date('Y-m-d',$value['stime']);
  431. if($value['time'] > 0)
  432. {
  433. $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
  434. }
  435. else
  436. {
  437. $info_list[$key]['time'] = "<p class='wc'><p>";
  438. }
  439. }
  440. $title = "在途数据".date('Y-m-d',time());
  441. $titlename = "<table border=1>
  442. <tr align='center'>
  443. <td>仓库</td>
  444. <td>SKU</td>
  445. <td>名称</td>
  446. <td>数量</td>
  447. <td>添加日期</td>
  448. <td>预达日期</td>
  449. <td>完成日期</td>
  450. <td>备注</td>
  451. </tr>
  452. </table>";
  453. $filename = $title.".xls";
  454. $tail = "";
  455. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  456. }
  457. }
  458. public function _excelzh()
  459. {
  460. if(isset($_GET['excel']))
  461. {
  462. $warehouse = $this->input->get('warehouse',true);
  463. $sku = $this->input->get('sku',true);
  464. $cz = $this->input->get('cz',true);
  465. $text = $this->input->post('text',true);
  466. $xztime = $this->input->get('xztime',true);
  467. $timetk = $this->input->get('timetk',true);
  468. $timetj = $this->input->get('timetj',true);
  469. $timetk = strtotime($timetk);
  470. $timetj = strtotime($timetj);
  471. $where = "time = '0' ";
  472. if($warehouse)
  473. {
  474. $where .= " and warehouse = '$warehouse'";
  475. }
  476. if($sku)
  477. {
  478. $where .= " and sku = '$sku'";
  479. }
  480. if($text)
  481. {
  482. $where .= " and text like '%$text%'";
  483. }
  484. if($cz != '')
  485. {
  486. $where .= " and cz = '$cz'";
  487. }
  488. if($timetk && $timetj)
  489. {
  490. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  491. }
  492. //数据排序
  493. $order_str = $xztime." desc";
  494. //取得信息列表
  495. $zh = array();
  496. $info_list = $this->whlabeltransport->find_all($where,'warehouse,sku,title,num,features,enter,stime,text');
  497. foreach ($info_list as $v)
  498. {
  499. $c = $this->whlabel->find_count('state = 0 and warehouse = "'.$v['warehouse'].'" and features = "'.$v['features'].'"');
  500. $warehouse = $this->warehouse->read($v['warehouse']);
  501. $v['warehouse'] = $warehouse['title'];
  502. $v['enter'] = date('Y-m-d H:i:s',$v['enter']);
  503. $v['stime'] = date('Y-m-d',$v['stime']);
  504. if(isset($zh[$v['features']]))
  505. {
  506. $zh[$v['features']]['num'] += $v['num'];
  507. }
  508. else
  509. {
  510. $zh[$v['features']] = $v;
  511. }
  512. $zh[$v['features']]['features'] = $c;
  513. }
  514. $title = "在途数据".date('Y-m-d',time());
  515. $titlename = "<table border=1>
  516. <tr align='center'>
  517. <td>仓库</td>
  518. <td>SKU</td>
  519. <td>名称</td>
  520. <td>在途数量</td>
  521. <td>库存数量</td>
  522. <td>添加在途日期</td>
  523. <td>预达日期</td>
  524. <td>备注</td>
  525. </tr>
  526. </table>";
  527. $filename = $title.".xls";
  528. $tail = "";
  529. $this->excel->get_fz2($zh,$titlename,$filename,$tail);
  530. }
  531. }
  532. //批量完成
  533. public function _list()
  534. {
  535. $post = $this->input->post(NULL, TRUE);
  536. if(isset($post['s']))
  537. {
  538. $cw = '';$i = 0;
  539. $id_arr = $this->input->post('s');
  540. $id_arr = explode(',',$id_arr);
  541. if(!$id_arr)
  542. {
  543. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  544. }
  545. //循环删除记录
  546. foreach ($id_arr as $v)
  547. {
  548. $id = $v;
  549. $data = $this->whlabeltransport->read($id);
  550. if($data['cz'] == '0')
  551. {
  552. $list = array();$num = "";$title = "";$features = "";
  553. $order = $this->input->post('order',true);
  554. $shop = $this->input->post('shop',true);
  555. $label['shop'] = $data['shop'];
  556. $label['sku'] = $data['sku'];
  557. $label['warehouse'] = $data['warehouse'];
  558. $label['purchase'] = $data['purchase'];
  559. $label['retreatwarehouse'] = $data['retreatwarehouse'];
  560. $label['state'] = 0;
  561. $time = time();
  562. $label['title'] = $data['title'];
  563. $label['number'] = $data['number'];
  564. $label['features'] = $data['features'];
  565. $label['enter'] = $time;
  566. $label['time'] = $time;//操作时间
  567. if($label['warehouse'] == '5')
  568. {
  569. $yza = $this->whlabel->find_all("sku = '".$label['sku']."' and warehouse = '".$label['warehouse']."'");
  570. if($yza)
  571. {
  572. if($label['features'] != $yza[0]['features'])
  573. {
  574. echo json_encode(array('msg'=>'此SKU的产品信息和现有不一致!','success'=>false));exit;
  575. }
  576. }
  577. $yzb = $this->whlabel->find_all("features = '".$label['features']."' and warehouse = '".$label['warehouse']."'");
  578. if($yzb)
  579. {
  580. if($label['sku'] != $yzb[0]['sku'])
  581. {
  582. echo json_encode(array('msg'=>'此产品信息的SKU和现有不一致!','success'=>false));exit;
  583. }
  584. }
  585. }
  586. $this->db->trans_begin();
  587. for($i=0;$i<$data['num'];$i++)
  588. {
  589. $label['label'] = time().rand(100,999).$i;//产品标签 辨别各个产品,暂不使用
  590. $label['cs'] = 1;//前期增加这个是在途库存添加的数据
  591. $this->whlabel->insert($label);
  592. }
  593. $this->whlabeltransport->save(array('time'=>$time,'cz'=>1),$data['id']);
  594. if ($this->db->trans_status() === TRUE)
  595. {
  596. $this->db->trans_commit();
  597. $i++;
  598. }
  599. else
  600. {
  601. $this->db->trans_rollback();
  602. $cw .= $data['sku'].' | ';
  603. }
  604. }
  605. }
  606. if(count($id_arr) == $i)
  607. {
  608. echo json_encode(array('msg'=>'入库成功!','success'=>true));exit;
  609. }
  610. else
  611. {
  612. echo json_encode(array('msg'=>'有入库失败数据:'.$cw,'success'=>false));exit;
  613. }
  614. }
  615. }
  616. //删除
  617. public function _del()
  618. {
  619. $post = $this->input->post(NULL, TRUE);
  620. if(isset($post['s']))
  621. {
  622. $id_arr = $this->input->post('s');
  623. $id_arr = explode(',',$id_arr);
  624. if(!$id_arr)
  625. {
  626. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  627. }
  628. //循环删除记录
  629. foreach ($id_arr as $v)
  630. {
  631. $data = $this->whlabeltransport->read($v);
  632. if($data['cz'] == '0')
  633. {
  634. $this->whlabeltransport->remove($v);
  635. }
  636. else
  637. {
  638. echo json_encode(array('msg'=>'有已完成数据!无法继续删除','success'=>false));exit;
  639. }
  640. }
  641. echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
  642. }
  643. }
  644. }