|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Service;
|
|
|
|
|
|
+use App\Model\RecordTable;
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
use Illuminate\Support\Facades\Config;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
@@ -415,6 +416,7 @@ class TestService extends Service
|
|
|
return [true, ''];
|
|
|
}
|
|
|
|
|
|
+ //-----------------------------------朗峰u8-----
|
|
|
public function getToken(){
|
|
|
list($status, $msg) = $this->SetU8();
|
|
|
if(! $status) return [false , $msg];
|
|
|
@@ -446,8 +448,6 @@ class TestService extends Service
|
|
|
return [true, [$host, $token]];
|
|
|
}
|
|
|
|
|
|
- //-----------------------------------朗峰u8-----
|
|
|
-
|
|
|
public function salesOrderGet($data){
|
|
|
list($status, $msg) = $this->getToken();
|
|
|
if(! $status) return [false, $msg];
|
|
|
@@ -556,7 +556,7 @@ class TestService extends Service
|
|
|
if(empty($data['iHead'])) return [false, '领料单表头信息不能为空'];
|
|
|
if(empty($data['iBody'])) return [false, '领料单表体信息不能为空'];
|
|
|
|
|
|
- $header = ["Authorization: {$token}",'Content-Type:application/json'];;
|
|
|
+ $header = ["Authorization: {$token}",'Content-Type:application/json'];
|
|
|
$url = $host . "/api/MaterialRequest/Add";
|
|
|
$json[] = [
|
|
|
"Inum" => "MaterialRequest",
|
|
|
@@ -565,8 +565,9 @@ class TestService extends Service
|
|
|
"iBody" => $data['iBody'],
|
|
|
],
|
|
|
];
|
|
|
+ $json_str = json_encode($json);
|
|
|
|
|
|
- list($status, $result) = $this->post_helper($url, json_encode($json), $header, 30);
|
|
|
+ list($status, $result) = $this->post_helper($url, $json_str, $header, 30);
|
|
|
if(! $status) return [false, $result];
|
|
|
if(! isset($result['code'])) return [false, '异常错误,请联系开发者'];
|
|
|
if($result['code'] != 0) return [false, $result['msg']];
|
|
|
@@ -630,6 +631,30 @@ class TestService extends Service
|
|
|
return [true, $result['data']];
|
|
|
}
|
|
|
|
|
|
+ public function recordList($data){
|
|
|
+ $model = RecordTable::where('del_time',0)
|
|
|
+ ->select('msg','data','type','crt_time')
|
|
|
+ ->orderBy('id','desc');
|
|
|
+
|
|
|
+ if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])) $model->whereBetween('crt_time',[$data['crt_time'][0],$data['crt_time'][1]]);
|
|
|
+ if(! empty($data['type'])) $model->where('type',$data['type']);
|
|
|
+
|
|
|
+ $list = $this->limit($model,'',$data);
|
|
|
+ $list = $this->fillData($list);
|
|
|
+
|
|
|
+ return [true,$list];
|
|
|
+ }
|
|
|
+
|
|
|
+ private function fillData($data){
|
|
|
+ if(empty($data['data'])) return $data;
|
|
|
+
|
|
|
+ foreach ($data['data'] as $key => $value){
|
|
|
+ $data['data'][$key]['crt_time'] = $value['crt_time'] ? date('Y-m-d H:i:s',$value['crt_time']) : '';
|
|
|
+ $data['data'][$key]['type_name'] = RecordTable::$type[$value['type']] ?? '';
|
|
|
+ }
|
|
|
+
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
/**
|
|
|
* 补全用友发货单子表金额字段(含换算率)
|
|
|
* 输入示例:
|