Whlabeltransport.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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. $label['rktype'] = 1;
  322. $this->whlabel->insert($label);
  323. }
  324. $this->whlabeltransport->save(array('time'=>$time,'cz'=>1),$data['id']);
  325. if ($this->db->trans_status() === TRUE)
  326. {
  327. $this->db->trans_commit();
  328. echo json_encode(array('msg'=>'入库成功!','id'=>$id,'time'=>date('Y-m-d H:i:s',$time),'success'=>true));exit;
  329. }
  330. else
  331. {
  332. $this->db->trans_rollback();
  333. echo json_encode(array('msg'=>'入库失败,请重试!','success'=>false));exit;
  334. }
  335. }
  336. else
  337. {
  338. echo json_encode(array('msg'=>'错误!已操作入库','success'=>false));exit;
  339. }
  340. }
  341. }
  342. //导出模板
  343. public function _presetout()
  344. {
  345. if(isset($_GET['excel']))
  346. {
  347. $where = "sku != 'Preset'";
  348. //数据排序
  349. $order_str = "id desc";
  350. if(empty($page))
  351. {
  352. $start = 0;
  353. $perpage = 1;
  354. }
  355. else
  356. {
  357. $start = ($page - 1)*$perpage;
  358. }
  359. $warehouse = $this->input->get('warehouse',true);
  360. if($warehouse)
  361. {
  362. $where .= " and warehouse = '".$warehouse."'";
  363. }
  364. //取得信息列表
  365. $info_list = $this->whlabel->find_pc($where,'warehouse,sku','*');
  366. $rows = array();$list = array();
  367. foreach ($info_list as $value)
  368. {
  369. $warehouse = $this->warehouse->read($value['warehouse']);
  370. $number = $value['number'];$ftime = time()-15*24*3600;
  371. $list[] = array($warehouse['title'],$value['sku'],'0','','');
  372. }
  373. $title = "在途模板";
  374. $titlename = "<table border=1>
  375. <tr align='center'>
  376. <td>仓库</td>
  377. <td>SKU</td>
  378. <td>数量</td>
  379. <td>预达日期(格式:2022-01-01)</td>
  380. <td>备注</td>
  381. </tr>
  382. </table>";
  383. $filename = $title.".xls";
  384. $tail = "";
  385. $this->excel->get_fz2($list,$titlename,$filename,$tail);
  386. }
  387. }
  388. public function _excel()
  389. {
  390. if(isset($_GET['excel']))
  391. {
  392. $warehouse = $this->input->get('warehouse',true);
  393. $sku = $this->input->get('sku',true);
  394. $cz = $this->input->get('cz',true);
  395. $text = $this->input->post('text',true);
  396. $xztime = $this->input->get('xztime',true);
  397. $timetk = $this->input->get('timetk',true);
  398. $timetj = $this->input->get('timetj',true);
  399. $timetk = strtotime($timetk);
  400. $timetj = strtotime($timetj);
  401. $where = "1=1 ";
  402. if($warehouse)
  403. {
  404. $where .= " and warehouse = '$warehouse'";
  405. }
  406. if($sku)
  407. {
  408. $where .= " and sku = '$sku'";
  409. }
  410. if($text)
  411. {
  412. $where .= " and text like '%$text%'";
  413. }
  414. if($cz != '')
  415. {
  416. $where .= " and cz = '$cz'";
  417. }
  418. if($timetk && $timetj)
  419. {
  420. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  421. }
  422. //数据排序
  423. $order_str = $xztime." desc";
  424. //取得信息列表
  425. $info_list = $this->whlabeltransport->find_all($where,'warehouse,sku,title,num,enter,stime,time,text');
  426. foreach ($info_list as $key=>$value)
  427. {
  428. $warehouse = $this->warehouse->read($value['warehouse']);
  429. $info_list[$key]['warehouse'] = $warehouse['title'];
  430. $info_list[$key]['enter'] = date('Y-m-d H:i:s',$value['enter']);
  431. $info_list[$key]['stime'] = date('Y-m-d',$value['stime']);
  432. if($value['time'] > 0)
  433. {
  434. $info_list[$key]['time'] = date('Y-m-d H:i:s',$value['time']);
  435. }
  436. else
  437. {
  438. $info_list[$key]['time'] = "<p class='wc'><p>";
  439. }
  440. }
  441. $title = "在途数据".date('Y-m-d',time());
  442. $titlename = "<table border=1>
  443. <tr align='center'>
  444. <td>仓库</td>
  445. <td>SKU</td>
  446. <td>名称</td>
  447. <td>数量</td>
  448. <td>添加日期</td>
  449. <td>预达日期</td>
  450. <td>完成日期</td>
  451. <td>备注</td>
  452. </tr>
  453. </table>";
  454. $filename = $title.".xls";
  455. $tail = "";
  456. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  457. }
  458. }
  459. public function _excelzh()
  460. {
  461. if(isset($_GET['excel']))
  462. {
  463. $warehouse = $this->input->get('warehouse',true);
  464. $sku = $this->input->get('sku',true);
  465. $cz = $this->input->get('cz',true);
  466. $text = $this->input->post('text',true);
  467. $xztime = $this->input->get('xztime',true);
  468. $timetk = $this->input->get('timetk',true);
  469. $timetj = $this->input->get('timetj',true);
  470. $timetk = strtotime($timetk);
  471. $timetj = strtotime($timetj);
  472. $where = "time = '0' ";
  473. if($warehouse)
  474. {
  475. $where .= " and warehouse = '$warehouse'";
  476. }
  477. if($sku)
  478. {
  479. $where .= " and sku = '$sku'";
  480. }
  481. if($text)
  482. {
  483. $where .= " and text like '%$text%'";
  484. }
  485. if($cz != '')
  486. {
  487. $where .= " and cz = '$cz'";
  488. }
  489. if($timetk && $timetj)
  490. {
  491. $where .= " and ".$xztime." > '$timetk' and ".$xztime." < '$timetj'";
  492. }
  493. //数据排序
  494. $order_str = $xztime." desc";
  495. //取得信息列表
  496. $zh = array();
  497. $info_list = $this->whlabeltransport->find_all($where,'warehouse,sku,title,num,features,enter,stime,text');
  498. foreach ($info_list as $v)
  499. {
  500. $c = $this->whlabel->find_count('state = 0 and warehouse = "'.$v['warehouse'].'" and features = "'.$v['features'].'"');
  501. $warehouse = $this->warehouse->read($v['warehouse']);
  502. $v['warehouse'] = $warehouse['title'];
  503. $v['enter'] = date('Y-m-d H:i:s',$v['enter']);
  504. $v['stime'] = date('Y-m-d',$v['stime']);
  505. if(isset($zh[$v['features']]))
  506. {
  507. $zh[$v['features']]['num'] += $v['num'];
  508. }
  509. else
  510. {
  511. $zh[$v['features']] = $v;
  512. }
  513. $zh[$v['features']]['features'] = $c;
  514. }
  515. $title = "在途数据".date('Y-m-d',time());
  516. $titlename = "<table border=1>
  517. <tr align='center'>
  518. <td>仓库</td>
  519. <td>SKU</td>
  520. <td>名称</td>
  521. <td>在途数量</td>
  522. <td>库存数量</td>
  523. <td>添加在途日期</td>
  524. <td>预达日期</td>
  525. <td>备注</td>
  526. </tr>
  527. </table>";
  528. $filename = $title.".xls";
  529. $tail = "";
  530. $this->excel->get_fz2($zh,$titlename,$filename,$tail);
  531. }
  532. }
  533. //批量完成
  534. public function _list()
  535. {
  536. $post = $this->input->post(NULL, TRUE);
  537. if(isset($post['s']))
  538. {
  539. $cw = '';$i = 0;
  540. $id_arr = $this->input->post('s');
  541. $id_arr = explode(',',$id_arr);
  542. if(!$id_arr)
  543. {
  544. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  545. }
  546. //循环删除记录
  547. foreach ($id_arr as $v)
  548. {
  549. $id = $v;
  550. $data = $this->whlabeltransport->read($id);
  551. if($data['cz'] == '0')
  552. {
  553. $list = array();$num = "";$title = "";$features = "";
  554. $order = $this->input->post('order',true);
  555. $shop = $this->input->post('shop',true);
  556. $label['shop'] = $data['shop'];
  557. $label['sku'] = $data['sku'];
  558. $label['warehouse'] = $data['warehouse'];
  559. $label['purchase'] = $data['purchase'];
  560. $label['retreatwarehouse'] = $data['retreatwarehouse'];
  561. $label['state'] = 0;
  562. $time = time();
  563. $label['title'] = $data['title'];
  564. $label['number'] = $data['number'];
  565. $label['features'] = $data['features'];
  566. $label['enter'] = $time;
  567. $label['time'] = $time;//操作时间
  568. if($label['warehouse'] == '5')
  569. {
  570. $yza = $this->whlabel->find_all("sku = '".$label['sku']."' and warehouse = '".$label['warehouse']."'");
  571. if($yza)
  572. {
  573. if($label['features'] != $yza[0]['features'])
  574. {
  575. echo json_encode(array('msg'=>'此SKU的产品信息和现有不一致!','success'=>false));exit;
  576. }
  577. }
  578. $yzb = $this->whlabel->find_all("features = '".$label['features']."' and warehouse = '".$label['warehouse']."'");
  579. if($yzb)
  580. {
  581. if($label['sku'] != $yzb[0]['sku'])
  582. {
  583. echo json_encode(array('msg'=>'此产品信息的SKU和现有不一致!','success'=>false));exit;
  584. }
  585. }
  586. }
  587. $this->db->trans_begin();
  588. for($i=0;$i<$data['num'];$i++)
  589. {
  590. $label['label'] = time().rand(100,999).$i;//产品标签 辨别各个产品,暂不使用
  591. $label['cs'] = 1;//前期增加这个是在途库存添加的数据
  592. $label['rktype'] = 1;
  593. $this->whlabel->insert($label);
  594. }
  595. $this->whlabeltransport->save(array('time'=>$time,'cz'=>1),$data['id']);
  596. if ($this->db->trans_status() === TRUE)
  597. {
  598. $this->db->trans_commit();
  599. $i++;
  600. }
  601. else
  602. {
  603. $this->db->trans_rollback();
  604. $cw .= $data['sku'].' | ';
  605. }
  606. }
  607. }
  608. if(count($id_arr) == $i)
  609. {
  610. echo json_encode(array('msg'=>'入库成功!','success'=>true));exit;
  611. }
  612. else
  613. {
  614. echo json_encode(array('msg'=>'有入库失败数据:'.$cw,'success'=>false));exit;
  615. }
  616. }
  617. }
  618. //删除
  619. public function _del()
  620. {
  621. $post = $this->input->post(NULL, TRUE);
  622. if(isset($post['s']))
  623. {
  624. $id_arr = $this->input->post('s');
  625. $id_arr = explode(',',$id_arr);
  626. if(!$id_arr)
  627. {
  628. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  629. }
  630. //循环删除记录
  631. foreach ($id_arr as $v)
  632. {
  633. $data = $this->whlabeltransport->read($v);
  634. if($data['cz'] == '0')
  635. {
  636. $this->whlabeltransport->remove($v);
  637. }
  638. else
  639. {
  640. echo json_encode(array('msg'=>'有已完成数据!无法继续删除','success'=>false));exit;
  641. }
  642. }
  643. echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
  644. }
  645. }
  646. }