|
@@ -46,13 +46,107 @@ class U8ServerService extends Service
|
|
|
|
|
|
|
|
|
public function purchaseRequisition($data, $user){
|
|
|
- $model = $this->databaseService->table('DispatchList as a')
|
|
|
- ->leftJoin('DispatchLists as b', 'b.DLID', 'a.DLID')
|
|
|
- ->leftJoin('Inventory as c', 'c.cInvCode', 'b.cInvCode')
|
|
|
- ->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');
|
|
|
+ $model = $this->databaseService->table('PU_AppVouch as a')
|
|
|
+ ->leftJoin('Person as c', 'c.cPersonCode', 'a.cPersonCode')
|
|
|
+ ->where('a.cMaker',$user['username'])
|
|
|
+ ->where('a.iverifystateex',0)
|
|
|
+ ->select('a.cMaker as crt_name', 'c.cPersonName as purchase_name','a.cBusType as business_type','a.cCode as order_number','a.dDate as order_date')
|
|
|
+ ->orderBy('a.ID','desc');
|
|
|
|
|
|
- $list = $this->limit($model,'',$data);
|
|
|
+ $list = $this->limit($model,'',$data);
|
|
|
|
|
|
return [true , $list];
|
|
|
}
|
|
|
+
|
|
|
+ public function purchaseRequisitionDetail($data, $user){
|
|
|
+ if(empty($data['order_number'])) return [false, '采购请购单号不能为空'];
|
|
|
+
|
|
|
+ $order = $this->databaseService->table('PU_AppVouch as a')
|
|
|
+ ->leftJoin('Person as c', 'c.cPersonCode', 'a.cPersonCode')
|
|
|
+ ->where('a.cMaker',$user['username'])
|
|
|
+ ->select('a.cMaker as crt_name', 'c.cPersonName as purchase_name','a.cBusType as business_type','a.cCode as order_number','a.dDate as order_date','a.ID as id')
|
|
|
+ ->first();
|
|
|
+ if(empty($order)) return [false, '采购请购单不存在'];
|
|
|
+ $order = $order->toArray();
|
|
|
+
|
|
|
+ $detail = $this->databaseService->table('PU_AppVouchs as a')
|
|
|
+ ->leftJoin('Inventory as b', 'b.cInvCode', 'a.cInvCode')
|
|
|
+ ->leftJoin('ComputationUnit as c', 'c.cComunitCode', 'b.cComUnitCode')
|
|
|
+ ->where('a.ID', $order['id'])
|
|
|
+ ->select('b.cInvName as product_title','b.cInvCode as product_code','a.fQuantity as quantity','c.cComUnitName as unit_title','a.dRequirDate as need_arrived_date')
|
|
|
+ ->get()->toArray();
|
|
|
+ $order['detail'] = $detail;
|
|
|
+
|
|
|
+ return [true, $order];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function purchaseOrder($data, $user){
|
|
|
+ $model = $this->databaseService->table('PO_Pomain as a')
|
|
|
+ ->leftJoin('Vendor as c', 'c.cVenCode', 'a.cVenCode')
|
|
|
+ ->where('a.cMaker',$user['username'])
|
|
|
+ ->where('a.iverifystateex',0)
|
|
|
+ ->select('a.cMaker as crt_name', 'a.cBusType as business_type','a.cPOID as order_number','a.dPODate as order_date','c.cVenName as supplier_title')
|
|
|
+ ->orderBy('a.POID','desc');
|
|
|
+
|
|
|
+ $list = $this->limit($model,'',$data);
|
|
|
+
|
|
|
+ return [true , $list];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function purchaseOrderDetail($data, $user){
|
|
|
+ if(empty($data['order_number'])) return [false, '采购单号不能为空'];
|
|
|
+
|
|
|
+ $order = $this->databaseService->table('PO_Pomain as a')
|
|
|
+ ->leftJoin('Vendor as c', 'c.cVenCode', 'a.cVenCode')
|
|
|
+ ->where('a.cMaker',$user['username'])
|
|
|
+ ->where('a.iverifystateex',0)
|
|
|
+ ->select('a.cMaker as crt_name', 'a.cBusType as business_type','a.cPOID as order_number','a.dPODate as order_date','c.cVenName as supplier_title','a.POID as id')
|
|
|
+ ->first();
|
|
|
+ if(empty($order)) return [false, '采购单不存在'];
|
|
|
+ $order = $order->toArray();
|
|
|
+
|
|
|
+ $detail = $this->databaseService->table('PO_Podetails as a')
|
|
|
+ ->leftJoin('Inventory as b', 'b.cInvCode', 'a.cInvCode')
|
|
|
+ ->leftJoin('ComputationUnit as c', 'c.cComunitCode', 'b.cComUnitCode')
|
|
|
+ ->where('a.POID', $order['id'])
|
|
|
+ ->select('b.cInvName as product_title','b.cInvCode as product_code','a.iQuantity as quantity','c.cComUnitName as unit_title','a.iSum as amount')
|
|
|
+ ->get()->toArray();
|
|
|
+ $order['detail'] = $detail;
|
|
|
+
|
|
|
+ return [true, $order];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function paymentOrder($data, $user){
|
|
|
+ $model = $this->databaseService->table('AP_ApplyPayVouch as a')
|
|
|
+ ->leftJoin('Vendor as c', 'c.cVenCode', 'a.cDwCode')
|
|
|
+ ->where('a.cOperator',$user['username'])
|
|
|
+ ->whereNull('a.cCheckMan')
|
|
|
+ ->select('a.cOperator as crt_name', 'c.cVenName as supplier_title','a.cVouchID as order_number','a.dVouchDate as order_date')
|
|
|
+ ->orderBy('a.PID','desc');
|
|
|
+
|
|
|
+ $list = $this->limit($model,'',$data);
|
|
|
+
|
|
|
+ return [true , $list];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function paymentOrderDetail($data, $user){
|
|
|
+ if(empty($data['order_number'])) return [false, '付款单号不能为空'];
|
|
|
+
|
|
|
+ $order = $this->databaseService->table('AP_ApplyPayVouch as a')
|
|
|
+ ->leftJoin('Vendor as c', 'c.cVenCode', 'a.cDwCode')
|
|
|
+ ->where('a.cOperator',$user['username'])
|
|
|
+ ->whereNull('a.cCheckMan')
|
|
|
+ ->select('a.cOperator as crt_name', 'c.cVenName as supplier_title','a.cVouchID as order_number','a.dVouchDate as order_date','a.PID as id')
|
|
|
+ ->first();
|
|
|
+ if(empty($order)) return [false, '付款单不存在'];
|
|
|
+ $order = $order->toArray();
|
|
|
+
|
|
|
+ $detail = $this->databaseService->table('AP_ApplyPayVouchs as a')
|
|
|
+ ->where('a.PID', $order['id'])
|
|
|
+ ->select('a.cSource as source','a.cCoVouchID as source_order_number','a.iApplyAmt_f as amount')
|
|
|
+ ->get()->toArray();
|
|
|
+ $order['detail'] = $detail;
|
|
|
+
|
|
|
+ return [true, $order];
|
|
|
+ }
|
|
|
}
|