longle.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class longle extends DooModel {
  4. public $lid;
  5. public $year;
  6. public $cid;
  7. public $category;
  8. public $status;
  9. public $stock_status;
  10. public $sell_status;
  11. public $preserve_status;
  12. public $stock_time;
  13. public $sell_time;
  14. public $preserve_time;
  15. public $statuslog;
  16. public $statusT;
  17. public $key_num;
  18. public $product;
  19. public $alloted_time;
  20. public $product_id;
  21. public $make_day;
  22. public $version;
  23. public $responsible;
  24. public $client;
  25. public $clientid;
  26. public $licences;
  27. public $SerialNumber;
  28. public $AuthorizeStr;
  29. public $AuthorizeFile;
  30. public $UpdateStr;
  31. public $UpdateFile;
  32. public $department_id;
  33. public $department_name;
  34. public $_table = 'CLD_longle';
  35. public $_primarykey = 'lid';
  36. public $_fields = array ('lid', 'year', 'cid','category','product_id', 'status','statuslog','statusT', 'key_num','SerialNumber','product','alloted_time', 'make_day','version', 'responsible','client','clientid'
  37. ,'licences' ,'AuthorizeStr','AuthorizeFile','UpdateStr','UpdateFile','department_id','department_name','stock_status','sell_status','preserve_status','stock_time','sell_time','preserve_time'
  38. );
  39. public function getLongleByStatus($year=0,$cid=0,$staff=0,$status=0,$search="",$productW=""){
  40. if(empty($search)){
  41. $str="( status=".$status." or statuslog like '%".$status."%' )";
  42. $str2=" and make_day like '%".$year."%'";
  43. $str3=" and cid =".$cid."";
  44. $str4=" and product like '%".$productW."%'";
  45. $str5=' and responsible="'.$staff.'"';
  46. if(empty($productW))
  47. $str4="";
  48. if($cid==0)
  49. $str3="";
  50. if($year==0)
  51. $str2="";
  52. if(empty($staff))
  53. $str5="";
  54. if($status==0)
  55. $str=" 1 ";
  56. //echo $str.$str2.$str3.$str4;
  57. // 'select * form CLD_longle as a left join CLD_client as b on (a.clientid =b.cid) where ( status=3 or statuslog like "%3%" ) and make_day like "%2015%" and cid =10';
  58. //echo $str.$str2.$str3.$str4.$str5;
  59. return $this->find ( array ('where' => $str.$str2.$str3.$str4.$str5, 'desc'=>'make_day', 'asArray' => TRUE ) );
  60. }else{
  61. return $this->find ( array ('where' => " key_num like '%".$search."%'",'desc'=>'make_day', 'asArray' => TRUE ) );
  62. }
  63. }
  64. public function getLongleReceive($cid,$status,$othercid=""){
  65. $str="";
  66. if(!empty($othercid))
  67. $str= " cid in (".$cid.",".$othercid." )";
  68. else
  69. $str= " cid in (".$cid." )";
  70. return $this->find ( array ('where' => $str." and (status=".$status." or responsible='') and make_day>='2019-01-01' ", 'asArray' => TRUE ) );
  71. }
  72. public function getLongleBykeynum($keynum){
  73. return $this->find ( array ('where' => " key_num = '".$keynum."'", 'asArray' => TRUE ) );
  74. }
  75. public function getLongleBykeynum2($keynum){
  76. return $this->find ( array ('where' => " key_num like '%".$keynum."%'",'limit'=>'10', 'asArray' => TRUE ) );
  77. }
  78. public function getLongleByKeyNumDetail($keynum,$SerialNumber=''){
  79. return $this->getOne ( array ('where' => " key_num = '".$keynum."' and SerialNumber like '".$SerialNumber."'", 'asArray' => TRUE ) );
  80. }
  81. public function getLongleByLid($lid){
  82. return $this->find ( array ('where' => " lid =".$lid, 'asArray' => TRUE ) );
  83. }
  84. public function getLongleByClient($clientname){
  85. return $this->find ( array ('where' => " client like '".$clientname."'", 'asArray' => TRUE ) );
  86. }
  87. public function getLongleBySerialNumber($SerialNumber){
  88. return $this->getOne ( array ('where' => " SerialNumber like '".$SerialNumber."'", 'asArray' => TRUE ) );
  89. }
  90. public function getLongleBySerialNumberList($SerialNumber){
  91. return $this->find ( array ('where' => " SerialNumber like '".$SerialNumber."'", 'asArray' => TRUE ) );
  92. }
  93. public function getLongleByClientid($client){
  94. return $this->find ( array ('where' => " clientid = '".$client."'", 'asArray' => TRUE ) );
  95. }
  96. // public function getLongleByRe($cid,$status=1){
  97. //
  98. // }
  99. public function getUser() {
  100. return $this->find ( array ('asc' => 'uid', 'asArray' => TRUE ) );
  101. }
  102. public function getUserByIdList($puid){
  103. return $this->find ( array ('where' => "uid= '".$puid."'", 'asArray' => TRUE ) );
  104. }
  105. }
  106. ?>