1
0

goodlyModel.php 1.5 KB

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