U8ServerService.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Service;
  3. use App\Jobs\ProcessDataJob;
  4. use App\Model\Depart;
  5. use App\Model\Employee;
  6. use App\Model\EmployeeDepartPermission;
  7. use App\Model\EmployeeIndex;
  8. use App\Model\Product;
  9. use App\Model\RevenueCost;
  10. use App\Model\RevenueCostTotal;
  11. use App\Model\SalaryEmployee;
  12. use Illuminate\Database\Schema\Blueprint;
  13. use Illuminate\Support\Facades\DB;
  14. use Illuminate\Support\Facades\Schema;
  15. class U8ServerService extends Service
  16. {
  17. protected $databaseService;
  18. /**
  19. * @var string|null
  20. */
  21. protected $error;
  22. /**
  23. * U8ServerService constructor.
  24. */
  25. public function __construct($loginUser = [])
  26. {
  27. $service = new U8DatabaseServerService($loginUser);
  28. $this->databaseService = $service->db;
  29. $this->error = $service->error;
  30. }
  31. /**
  32. * 获取错误信息
  33. *
  34. * @return string|null
  35. */
  36. public function getError()
  37. {
  38. return $this->error;
  39. }
  40. public function purchaseRequisition($data, $user){
  41. $model = $this->databaseService->table('DispatchList as a')
  42. ->leftJoin('DispatchLists as b', 'b.DLID', 'a.DLID')
  43. ->leftJoin('Inventory as c', 'c.cInvCode', 'b.cInvCode')
  44. ->select('a.cDLCode as cdlcode', 'a.DLID as id', 'a.cCusName as customer_name', 'b.cSOCode as csocode', 'a.cDepCode as cdepcode', 'a.cCusCode as cuscode', 'a.dDate as date','b.irowno', 'b.iDLsID as idlsid', 'b.cWhCode as cwhcode', 'b.cInvCode as cinvcode', 'b.cInvName as product_title', 'b.cFree1 as cfree1', 'b.cFree2 as cfree2', 'b.cPosition as cposition', 'b.cBatch as cbatch', 'b.iQuantity as iquantity', 'b.iNum as inum', 'b.iInvExchRate as iinvexchrate', 'b.fOutQuantity as out_quantity', 'b.iUnitPrice as iunitcost', 'b.iMoney as imoney', 'b.cDefine28 as technology_material', 'b.cDefine30 as process_mark', 'c.cInvStd as product_size', DB::raw('(b.iQuantity - b.fOutQuantity) as quantity'), 'a.cMemo as table_header_mark', 'b.cMemo as table_body_mark');
  45. $list = $this->limit($model,'',$data);
  46. return [true , $list];
  47. }
  48. }