1
0

goodlyModel.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. class flow_goodlyClassModel extends flowModel
  3. {
  4. public function initModel()
  5. {
  6. $this->goodsobj = m('goods');
  7. }
  8. //审核完成处理
  9. protected function flowcheckfinsh($zt){
  10. /*
  11. m('goodss')->update('status='.$zt.'',"`mid`='$this->id'");
  12. $aid = '0';
  13. $rows = m('goodss')->getall("`mid`='$this->id'",'aid');
  14. foreach($rows as $k=>$rs)$aid.=','.$rs['aid'].'';
  15. m('goods')->setstock($aid);*/
  16. }
  17. //作废或删除时
  18. protected function flowzuofeibill($sm)
  19. {
  20. //删除出库详情的
  21. m('goodss')->delete("`mid`='$this->id'");
  22. }
  23. //子表数据替换处理
  24. protected function flowsubdata($rows, $lx=0){
  25. $db = m('goods');
  26. $lygya = array('','需要','已归还');
  27. foreach($rows as $k=>$rs){
  28. $one = $db->getone($rs['aid']);
  29. if($one){
  30. $name = $one['name'];
  31. if(!isempt($one['xinghao']))$name.='('.$one['xinghao'].')';
  32. if($lx==1){
  33. $rows[$k]['aid'] = $name;
  34. $rows[$k]['count'] = 0-$rs['count']; //负数显示为正数
  35. if(isset($rs['lygh'])){
  36. $rows[$k]['lygh']=arrvalue($lygya, $rs['lygh']);
  37. }
  38. }
  39. $rows[$k]['unit'] = $one['unit'];
  40. $rows[$k]['temp_aid'] = $name;
  41. }
  42. }
  43. return $rows;
  44. }
  45. //$lx,0默认,1详情展示,2列表显示
  46. public function flowrsreplace($rs, $lx=0)
  47. {
  48. $rs['states']= $rs['state'];
  49. $rs['state'] = $this->goodsobj->crkstate($rs['state'],1);
  50. //读取物品
  51. if($lx==2){
  52. $rs['wupinlist'] = $this->goodsobj->getgoodninfo($rs['id'], 1);
  53. }
  54. return $rs;
  55. }
  56. }
粤ICP备19079148号