|
|
@@ -985,15 +985,9 @@ class Synchronization extends Api
|
|
|
{
|
|
|
mkdir(ROOT_PATH.'public/'.date('Y-m-d',time()),0777,true);
|
|
|
}
|
|
|
-// $lastID = \db('设备_产量计酬')->order('UniqId desc')->value('UniqId');
|
|
|
-// if (empty($lastID)){
|
|
|
-// $lastID = 0;
|
|
|
-// }
|
|
|
$db5 = \db()->connect(config('database.db5'));
|
|
|
$where = [
|
|
|
-// 'sczl_rq'=>date('Y-m-d',time()),
|
|
|
-// 'UniqId' =>['>',$lastID]
|
|
|
- 'sczl_rq' => ['>=','2024-04-01']
|
|
|
+ 'sczl_rq' => ['>=','2024-04-01 00:00:00']
|
|
|
];
|
|
|
$productData = $db5->name('设备_产量计酬')
|
|
|
->where($where)
|
|
|
@@ -1051,14 +1045,13 @@ class Synchronization extends Api
|
|
|
$data[$key]['sczl_gdbh'] = $workcode;
|
|
|
}
|
|
|
//插入设备产量计酬数据
|
|
|
- \db()->startTrans();
|
|
|
- try {
|
|
|
- \db('设备_产量计酬')->where('sczl_rq','>=','2024-04-01 00:00:00')->delete();
|
|
|
- $sql = \db('设备_产量计酬')->fetchSql(true)->insertAll($data);
|
|
|
- $res = \db()->query($sql);
|
|
|
- }catch (\Exception $e){
|
|
|
- \db()->rollback();
|
|
|
+ \db('设备_产量计酬')->delete(true);
|
|
|
+ $sql = \db('设备_产量计酬')->fetchSql(true)->insertAll($data);
|
|
|
+ $res = \db()->query($sql);
|
|
|
+ if ($res !== false){
|
|
|
+ $this->success('同步成功');
|
|
|
+ }else{
|
|
|
+ $this->error('同步失败');
|
|
|
}
|
|
|
- $this->success('同步成功');
|
|
|
}
|
|
|
}
|