goodlyModel.php 1.4 KB

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