|
@@ -280,7 +280,12 @@ class Product extends Api
|
|
|
if (!isset($params) || !isset($params[0]['UniqID'])){
|
|
if (!isset($params) || !isset($params[0]['UniqID'])){
|
|
|
$this->error('参数不能为空');
|
|
$this->error('参数不能为空');
|
|
|
}
|
|
}
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params);
|
|
|
|
|
+ if ($operator === '' && isset($params[0])) {
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params[0]);
|
|
|
|
|
+ }
|
|
|
$i = 0;
|
|
$i = 0;
|
|
|
|
|
+ $productLogs = [];
|
|
|
foreach ($params as $key=>$value){
|
|
foreach ($params as $key=>$value){
|
|
|
$data = [];
|
|
$data = [];
|
|
|
if (!empty($value['A_power'])){
|
|
if (!empty($value['A_power'])){
|
|
@@ -307,12 +312,13 @@ class Product extends Api
|
|
|
if (!empty($value['Gy0_site'])){
|
|
if (!empty($value['Gy0_site'])){
|
|
|
$data['Gy0_site'] = $value['Gy0_site'];
|
|
$data['Gy0_site'] = $value['Gy0_site'];
|
|
|
}
|
|
}
|
|
|
|
|
+ $oldGy = \db('产品_工艺资料')->where('UniqID', $value['UniqID'])->find();
|
|
|
// 如果修改了设备编号 → 同步未开工工单_工艺资料
|
|
// 如果修改了设备编号 → 同步未开工工单_工艺资料
|
|
|
$newSbbh = isset($value['machine']) ? trim((string)$value['machine']) : '';
|
|
$newSbbh = isset($value['machine']) ? trim((string)$value['machine']) : '';
|
|
|
$syncSql = '';
|
|
$syncSql = '';
|
|
|
if ($newSbbh !== '') {
|
|
if ($newSbbh !== '') {
|
|
|
// 取产品_工艺资料的 Gy0_cpdh / Gy0_yjno / Gy0_gxh
|
|
// 取产品_工艺资料的 Gy0_cpdh / Gy0_yjno / Gy0_gxh
|
|
|
- $gyInfo = \db('产品_工艺资料')->where('UniqID', $value['UniqID'])->field('Gy0_cpdh, Gy0_yjno, Gy0_gxh')->find();
|
|
|
|
|
|
|
+ $gyInfo = $oldGy;
|
|
|
if (!empty($gyInfo)) {
|
|
if (!empty($gyInfo)) {
|
|
|
$cpdh = trim($gyInfo['Gy0_cpdh']);
|
|
$cpdh = trim($gyInfo['Gy0_cpdh']);
|
|
|
$yjno = trim($gyInfo['Gy0_yjno']);
|
|
$yjno = trim($gyInfo['Gy0_yjno']);
|
|
@@ -334,12 +340,37 @@ class Product extends Api
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
$i++;
|
|
$i++;
|
|
|
|
|
+ if (!empty($oldGy) && !empty($data)) {
|
|
|
|
|
+ $productLogs = array_merge($productLogs, $this->buildProductFieldChangeLogs($oldGy, $data, [
|
|
|
|
|
+ '产品编号' => isset($oldGy['Gy0_cpdh']) ? trim($oldGy['Gy0_cpdh']) : '',
|
|
|
|
|
+ '印件号' => isset($oldGy['Gy0_yjno']) ? $oldGy['Gy0_yjno'] : '',
|
|
|
|
|
+ '工序号' => isset($oldGy['Gy0_gxh']) ? $oldGy['Gy0_gxh'] : '',
|
|
|
|
|
+ '方案' => isset($oldGy['Gy0_方案']) ? $oldGy['Gy0_方案'] : '',
|
|
|
|
|
+ '业务表' => '产品_工艺资料',
|
|
|
|
|
+ 'RecordUniqid' => $value['UniqID'],
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ]));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
// 执行级联同步(不影响主更新的成功判定)
|
|
// 执行级联同步(不影响主更新的成功判定)
|
|
|
if ($syncSql !== '') {
|
|
if ($syncSql !== '') {
|
|
|
Db::execute($syncSql);
|
|
Db::execute($syncSql);
|
|
|
|
|
+ $productLogs[] = [
|
|
|
|
|
+ '产品编号' => !empty($oldGy['Gy0_cpdh']) ? trim($oldGy['Gy0_cpdh']) : '',
|
|
|
|
|
+ '印件号' => isset($oldGy['Gy0_yjno']) ? $oldGy['Gy0_yjno'] : '',
|
|
|
|
|
+ '工序号' => isset($oldGy['Gy0_gxh']) ? $oldGy['Gy0_gxh'] : '',
|
|
|
|
|
+ '方案' => isset($oldGy['Gy0_方案']) ? $oldGy['Gy0_方案'] : '',
|
|
|
|
|
+ '业务表' => '工单_工艺资料',
|
|
|
|
|
+ 'RecordUniqid' => $value['UniqID'],
|
|
|
|
|
+ '操作类型' => '修改',
|
|
|
|
|
+ '字段名' => 'Gy0_sbbh',
|
|
|
|
|
+ '修改后' => $newSbbh,
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ '备注' => '同步未开工工单机台',
|
|
|
|
|
+ ];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveProductOperateLog($productLogs);
|
|
|
if ($i !== 0){
|
|
if ($i !== 0){
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
}else{
|
|
@@ -366,9 +397,21 @@ class Product extends Api
|
|
|
}
|
|
}
|
|
|
$code = $params['印品代号'];
|
|
$code = $params['印品代号'];
|
|
|
unset($params['印品代号']);
|
|
unset($params['印品代号']);
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params);
|
|
|
|
|
+ unset($params['sys_id']);
|
|
|
|
|
+ $oldProduct = db('产品_基本资料')->where('产品编号',$code)->find();
|
|
|
$sql = db('产品_基本资料')->where('产品编号',$code)->fetchSql(true)->update($params);
|
|
$sql = db('产品_基本资料')->where('产品编号',$code)->fetchSql(true)->update($params);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ if (!empty($oldProduct)) {
|
|
|
|
|
+ $this->saveProductOperateLog($this->buildProductFieldChangeLogs($oldProduct, $params, [
|
|
|
|
|
+ '产品编号' => $code,
|
|
|
|
|
+ '产品名称' => isset($oldProduct['产品名称']) ? $oldProduct['产品名称'] : '',
|
|
|
|
|
+ '业务表' => '产品_基本资料',
|
|
|
|
|
+ 'RecordUniqid' => isset($oldProduct['UniqID']) ? $oldProduct['UniqID'] : '',
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ]));
|
|
|
|
|
+ }
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('更新失败');
|
|
$this->error('更新失败');
|
|
@@ -394,9 +437,22 @@ class Product extends Api
|
|
|
if ($params['status'] == 2){
|
|
if ($params['status'] == 2){
|
|
|
$status = '停产';
|
|
$status = '停产';
|
|
|
}
|
|
}
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params);
|
|
|
|
|
+ $oldProduct = db('产品_基本资料')->where('产品编号',$code)->field('UniqID,产品名称,状态')->find();
|
|
|
$sql = db('产品_基本资料')->where('产品编号',$code)->fetchSql(true)->setField('状态',$status);
|
|
$sql = db('产品_基本资料')->where('产品编号',$code)->fetchSql(true)->setField('状态',$status);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $this->saveProductOperateLog([[
|
|
|
|
|
+ '产品编号' => $code,
|
|
|
|
|
+ '产品名称' => !empty($oldProduct['产品名称']) ? $oldProduct['产品名称'] : '',
|
|
|
|
|
+ '业务表' => '产品_基本资料',
|
|
|
|
|
+ 'RecordUniqid' => !empty($oldProduct['UniqID']) ? $oldProduct['UniqID'] : '',
|
|
|
|
|
+ '操作类型' => '停产',
|
|
|
|
|
+ '字段名' => '状态',
|
|
|
|
|
+ '修改前' => !empty($oldProduct['状态']) ? $oldProduct['状态'] : '',
|
|
|
|
|
+ '修改后' => $status,
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ]]);
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('更新失败');
|
|
$this->error('更新失败');
|
|
@@ -556,6 +612,14 @@ class Product extends Api
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
db()->commit();
|
|
db()->commit();
|
|
|
|
|
+ $this->saveProductOperateLog([[
|
|
|
|
|
+ '产品编号' => $params['to_code'],
|
|
|
|
|
+ '方案' => isset($params['to_pro']) ? $params['to_pro'] : '',
|
|
|
|
|
+ '业务表' => $strategy['table'],
|
|
|
|
|
+ '操作类型' => '复制',
|
|
|
|
|
+ 'sys_id' => $sys_id,
|
|
|
|
|
+ '备注' => '从'.$params['from_code'].'复制'.count($processedData).'条',
|
|
|
|
|
+ ]]);
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
db()->rollback();
|
|
db()->rollback();
|
|
|
$this->error("复制{$strategy['table']}数据失败: " . $e->getMessage());
|
|
$this->error("复制{$strategy['table']}数据失败: " . $e->getMessage());
|
|
@@ -588,6 +652,17 @@ class Product extends Api
|
|
|
$sql = db('产品_工艺资料')->where($where)->fetchSql(true)->setField('Gy0_方案',$params['new_name']);
|
|
$sql = db('产品_工艺资料')->where($where)->fetchSql(true)->setField('Gy0_方案',$params['new_name']);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $this->saveProductOperateLog([[
|
|
|
|
|
+ '产品编号' => $params['code'],
|
|
|
|
|
+ '方案' => $params['new_name'],
|
|
|
|
|
+ '业务表' => '产品_工艺资料',
|
|
|
|
|
+ '操作类型' => '修改',
|
|
|
|
|
+ '字段名' => 'Gy0_方案',
|
|
|
|
|
+ '修改前' => $params['old_name'],
|
|
|
|
|
+ '修改后' => $params['new_name'],
|
|
|
|
|
+ 'sys_id' => $this->getProductLogOperator($params),
|
|
|
|
|
+ '备注' => '工艺方案更名',
|
|
|
|
|
+ ]]);
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('更新失败');
|
|
$this->error('更新失败');
|
|
@@ -607,7 +682,9 @@ class Product extends Api
|
|
|
if (empty($params) || !isset($params[0]['UniqID'])){
|
|
if (empty($params) || !isset($params[0]['UniqID'])){
|
|
|
$this->error('参数不能为空');
|
|
$this->error('参数不能为空');
|
|
|
}
|
|
}
|
|
|
|
|
+ $operator = $this->pickProductLogOperator($params);
|
|
|
$i = 0;
|
|
$i = 0;
|
|
|
|
|
+ $productLogs = [];
|
|
|
foreach ($params as $key=>$value){
|
|
foreach ($params as $key=>$value){
|
|
|
$data = [];
|
|
$data = [];
|
|
|
if (!empty($value['Gy0_yjno'])){
|
|
if (!empty($value['Gy0_yjno'])){
|
|
@@ -622,12 +699,17 @@ class Product extends Api
|
|
|
if (!empty($value['Gy0_ls'])){
|
|
if (!empty($value['Gy0_ls'])){
|
|
|
$data['Gy0_ls'] = $value['Gy0_ls'];
|
|
$data['Gy0_ls'] = $value['Gy0_ls'];
|
|
|
}
|
|
}
|
|
|
|
|
+ $oldGy = \db('产品_工艺资料')->where('UniqID',$value['UniqID'])->find();
|
|
|
$sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
|
|
$sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
$i++;
|
|
$i++;
|
|
|
|
|
+ if (!empty($oldGy)) {
|
|
|
|
|
+ $productLogs = array_merge($productLogs, $this->buildProductFieldChangeLogs($oldGy, $data, $this->gyLogBase($oldGy, $value['UniqID'], $operator)));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveProductOperateLog($productLogs);
|
|
|
if ($i !== 0){
|
|
if ($i !== 0){
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
}else{
|
|
@@ -648,7 +730,9 @@ class Product extends Api
|
|
|
if (empty($params) || !isset($params[0]['UniqID'])){
|
|
if (empty($params) || !isset($params[0]['UniqID'])){
|
|
|
$this->error('参数不能为空');
|
|
$this->error('参数不能为空');
|
|
|
}
|
|
}
|
|
|
|
|
+ $operator = $this->pickProductLogOperator($params);
|
|
|
$i = 0;
|
|
$i = 0;
|
|
|
|
|
+ $productLogs = [];
|
|
|
foreach ($params as $key=>$value){
|
|
foreach ($params as $key=>$value){
|
|
|
$data = [];
|
|
$data = [];
|
|
|
if (!empty($value['Gy0_Ms'])){
|
|
if (!empty($value['Gy0_Ms'])){
|
|
@@ -663,12 +747,17 @@ class Product extends Api
|
|
|
$data['Add_gxmc'] = $value['Add_gxmc'];
|
|
$data['Add_gxmc'] = $value['Add_gxmc'];
|
|
|
$data['工序备注'] = $value['remark'];
|
|
$data['工序备注'] = $value['remark'];
|
|
|
|
|
|
|
|
|
|
+ $oldGy = \db('产品_工艺资料')->where('UniqID',$value['UniqID'])->find();
|
|
|
$sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
|
|
$sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
$i++;
|
|
$i++;
|
|
|
|
|
+ if (!empty($oldGy)) {
|
|
|
|
|
+ $productLogs = array_merge($productLogs, $this->buildProductFieldChangeLogs($oldGy, $data, $this->gyLogBase($oldGy, $value['UniqID'], $operator)));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveProductOperateLog($productLogs);
|
|
|
if ($i !== 0){
|
|
if ($i !== 0){
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
}else{
|
|
@@ -689,7 +778,9 @@ class Product extends Api
|
|
|
if (empty($params) || !isset($params[0]['UniqID'])){
|
|
if (empty($params) || !isset($params[0]['UniqID'])){
|
|
|
$this->error('参数不能为空');
|
|
$this->error('参数不能为空');
|
|
|
}
|
|
}
|
|
|
|
|
+ $operator = $this->pickProductLogOperator($params);
|
|
|
$i = 0;
|
|
$i = 0;
|
|
|
|
|
+ $productLogs = [];
|
|
|
foreach ($params as $key=>$value){
|
|
foreach ($params as $key=>$value){
|
|
|
$data = [];
|
|
$data = [];
|
|
|
if (!empty($value['artificial_zp'])){
|
|
if (!empty($value['artificial_zp'])){
|
|
@@ -710,12 +801,17 @@ class Product extends Api
|
|
|
if (!empty($value['machine_fj'])){
|
|
if (!empty($value['machine_fj'])){
|
|
|
$data['机检_废检'] = $value['machine_fj'];
|
|
$data['机检_废检'] = $value['machine_fj'];
|
|
|
}
|
|
}
|
|
|
|
|
+ $oldGy = \db('产品_工艺资料')->where('UniqID',$value['UniqID'])->find();
|
|
|
$sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
|
|
$sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
$i++;
|
|
$i++;
|
|
|
|
|
+ if (!empty($oldGy)) {
|
|
|
|
|
+ $productLogs = array_merge($productLogs, $this->buildProductFieldChangeLogs($oldGy, $data, $this->gyLogBase($oldGy, $value['UniqID'], $operator)));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveProductOperateLog($productLogs);
|
|
|
if ($i !== 0){
|
|
if ($i !== 0){
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
}else{
|
|
@@ -755,9 +851,21 @@ class Product extends Api
|
|
|
$this->error('参数不能为空');
|
|
$this->error('参数不能为空');
|
|
|
}
|
|
}
|
|
|
$UniqId = $params['UniqId'];
|
|
$UniqId = $params['UniqId'];
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params);
|
|
|
unset($params['UniqId']);
|
|
unset($params['UniqId']);
|
|
|
|
|
+ $oldYj = \db('产品_印件资料')->where('UniqId',$UniqId)->find();
|
|
|
$res = \db('产品_印件资料')->where('UniqId',$UniqId)->update($params);
|
|
$res = \db('产品_印件资料')->where('UniqId',$UniqId)->update($params);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ if (!empty($oldYj)) {
|
|
|
|
|
+ $this->saveProductOperateLog($this->buildProductFieldChangeLogs($oldYj, $params, [
|
|
|
|
|
+ '产品编号' => isset($oldYj['yj_cpdh']) ? $oldYj['yj_cpdh'] : '',
|
|
|
|
|
+ '产品名称' => isset($oldYj['yj_yjmc']) ? $oldYj['yj_yjmc'] : '',
|
|
|
|
|
+ '印件号' => isset($params['yj_yjno']) ? $params['yj_yjno'] : (isset($oldYj['yj_yjno']) ? $oldYj['yj_yjno'] : ''),
|
|
|
|
|
+ '业务表' => '产品_印件资料',
|
|
|
|
|
+ 'RecordUniqid' => $UniqId,
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ]));
|
|
|
|
|
+ }
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('更新失败');
|
|
$this->error('更新失败');
|
|
@@ -781,8 +889,18 @@ class Product extends Api
|
|
|
}
|
|
}
|
|
|
$params['UniqId'] = $UniqId;
|
|
$params['UniqId'] = $UniqId;
|
|
|
$params['sys_rq'] = date('Y-m-d H:i:s');
|
|
$params['sys_rq'] = date('Y-m-d H:i:s');
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params);
|
|
|
$res = \db('产品_印件资料')->insert($params);
|
|
$res = \db('产品_印件资料')->insert($params);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $this->saveProductOperateLog([[
|
|
|
|
|
+ '产品编号' => isset($params['yj_cpdh']) ? $params['yj_cpdh'] : '',
|
|
|
|
|
+ '产品名称' => isset($params['yj_yjmc']) ? $params['yj_yjmc'] : '',
|
|
|
|
|
+ '印件号' => isset($params['yj_yjno']) ? $params['yj_yjno'] : '',
|
|
|
|
|
+ '业务表' => '产品_印件资料',
|
|
|
|
|
+ 'RecordUniqid' => $UniqId,
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ]]);
|
|
|
$this->success('新增成功');
|
|
$this->success('新增成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('新增失败');
|
|
$this->error('新增失败');
|
|
@@ -1009,9 +1127,20 @@ class Product extends Api
|
|
|
}
|
|
}
|
|
|
$params['UniqID'] = $UniqId;
|
|
$params['UniqID'] = $UniqId;
|
|
|
$params['Sys_rq'] = date('Y-m-d H:i:s');
|
|
$params['Sys_rq'] = date('Y-m-d H:i:s');
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params);
|
|
|
$sql = \db('产品_工艺资料')->fetchSql(true)->insert($params);
|
|
$sql = \db('产品_工艺资料')->fetchSql(true)->insert($params);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $this->saveProductOperateLog([[
|
|
|
|
|
+ '产品编号' => isset($params['Gy0_cpdh']) ? $params['Gy0_cpdh'] : '',
|
|
|
|
|
+ '印件号' => isset($params['Gy0_yjno']) ? $params['Gy0_yjno'] : '',
|
|
|
|
|
+ '工序号' => isset($params['Gy0_gxh']) ? $params['Gy0_gxh'] : '',
|
|
|
|
|
+ '方案' => isset($params['Gy0_方案']) ? $params['Gy0_方案'] : '',
|
|
|
|
|
+ '业务表' => '产品_工艺资料',
|
|
|
|
|
+ 'RecordUniqid' => $UniqId,
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ]]);
|
|
|
$this->success('新增成功');
|
|
$this->success('新增成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('新增失败');
|
|
$this->error('新增失败');
|
|
@@ -1073,10 +1202,23 @@ class Product extends Api
|
|
|
$this->error('参数不能为空');
|
|
$this->error('参数不能为空');
|
|
|
}
|
|
}
|
|
|
$UniqId = $params['UniqId'];
|
|
$UniqId = $params['UniqId'];
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params);
|
|
|
unset($params['UniqId']);
|
|
unset($params['UniqId']);
|
|
|
|
|
+ $oldYb = \db('产品_印版资料')->where('UniqId',$UniqId)->find();
|
|
|
$sql = \db('产品_印版资料')->where('UniqId',$UniqId)->fetchSql(true)->update($params);
|
|
$sql = \db('产品_印版资料')->where('UniqId',$UniqId)->fetchSql(true)->update($params);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ if (!empty($oldYb)) {
|
|
|
|
|
+ $this->saveProductOperateLog($this->buildProductFieldChangeLogs($oldYb, $params, [
|
|
|
|
|
+ '产品编号' => isset($oldYb['YB_Cpdh']) ? $oldYb['YB_Cpdh'] : '',
|
|
|
|
|
+ '印件号' => isset($oldYb['YB_Yjno']) ? $oldYb['YB_Yjno'] : '',
|
|
|
|
|
+ '工序号' => isset($oldYb['YB_gxh']) ? $oldYb['YB_gxh'] : '',
|
|
|
|
|
+ '方案' => isset($oldYb['YB_方案']) ? $oldYb['YB_方案'] : '',
|
|
|
|
|
+ '业务表' => '产品_印版资料',
|
|
|
|
|
+ 'RecordUniqid' => $UniqId,
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ]));
|
|
|
|
|
+ }
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('更新失败');
|
|
$this->error('更新失败');
|
|
@@ -1167,9 +1309,20 @@ class Product extends Api
|
|
|
$params['UniqID'] = $UniqId;
|
|
$params['UniqID'] = $UniqId;
|
|
|
$params['考核印数'] = '0.00';
|
|
$params['考核印数'] = '0.00';
|
|
|
$params['Sys_rq'] = date('Y-m-d H:i:s');
|
|
$params['Sys_rq'] = date('Y-m-d H:i:s');
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params);
|
|
|
$sql = \db('产品_印版资料')->fetchSql(true)->insert($params);
|
|
$sql = \db('产品_印版资料')->fetchSql(true)->insert($params);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $this->saveProductOperateLog([[
|
|
|
|
|
+ '产品编号' => isset($params['YB_Cpdh']) ? $params['YB_Cpdh'] : '',
|
|
|
|
|
+ '印件号' => isset($params['YB_Yjno']) ? $params['YB_Yjno'] : '',
|
|
|
|
|
+ '工序号' => isset($params['YB_gxh']) ? $params['YB_gxh'] : '',
|
|
|
|
|
+ '方案' => isset($params['YB_方案']) ? $params['YB_方案'] : '',
|
|
|
|
|
+ '业务表' => '产品_印版资料',
|
|
|
|
|
+ 'RecordUniqid' => $UniqId,
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ]]);
|
|
|
$this->success('新增成功');
|
|
$this->success('新增成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('新增失败');
|
|
$this->error('新增失败');
|
|
@@ -1234,28 +1387,27 @@ class Product extends Api
|
|
|
// 5. 查询要删除的工艺详情
|
|
// 5. 查询要删除的工艺详情
|
|
|
$processDetails = Db::name('产品_工艺资料')
|
|
$processDetails = Db::name('产品_工艺资料')
|
|
|
->where('UniqID', 'in', $uniqIds)
|
|
->where('UniqID', 'in', $uniqIds)
|
|
|
- ->field('UniqID, Gy0_cpdh, Gy0_yjno, Gy0_gxh')
|
|
|
|
|
|
|
+ ->field('UniqID, Gy0_cpdh, Gy0_yjno, Gy0_gxh, Gy0_方案')
|
|
|
->select();
|
|
->select();
|
|
|
|
|
|
|
|
if (empty($processDetails)) {
|
|
if (empty($processDetails)) {
|
|
|
$this->error('未找到要删除的工艺详情');
|
|
$this->error('未找到要删除的工艺详情');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 6. 准备日志记录
|
|
|
|
|
$logArray = [];
|
|
$logArray = [];
|
|
|
- $currentTime = date('Y-m-d H:i:s');
|
|
|
|
|
-
|
|
|
|
|
foreach ($processDetails as $item) {
|
|
foreach ($processDetails as $item) {
|
|
|
$logArray[] = [
|
|
$logArray[] = [
|
|
|
- 'Gd_gdbh' => $item['Gy0_cpdh'] ?? '',
|
|
|
|
|
- 'yjno' => $item['Gy0_yjno'] ?? '',
|
|
|
|
|
- 'gxh' => $item['Gy0_gxh'] ?? '',
|
|
|
|
|
- 'ModifyUser' => $userId,
|
|
|
|
|
- 'ModifyTime' => $currentTime,
|
|
|
|
|
- 'FieldName' => '产品工艺删除',
|
|
|
|
|
- 'OldValue' => '存在', // 记录删除前的状态
|
|
|
|
|
- 'NewValue' => '已删除',
|
|
|
|
|
- 'ModifySource' => '产品工艺删除'
|
|
|
|
|
|
|
+ '产品编号' => $item['Gy0_cpdh'] ?? '',
|
|
|
|
|
+ '印件号' => $item['Gy0_yjno'] ?? '',
|
|
|
|
|
+ '工序号' => $item['Gy0_gxh'] ?? '',
|
|
|
|
|
+ '方案' => $item['Gy0_方案'] ?? '',
|
|
|
|
|
+ '业务表' => '产品_工艺资料',
|
|
|
|
|
+ 'RecordUniqid' => $item['UniqID'] ?? '',
|
|
|
|
|
+ '操作类型' => '删除',
|
|
|
|
|
+ '修改前' => '存在',
|
|
|
|
|
+ '修改后' => '已删除',
|
|
|
|
|
+ 'sys_id' => $userId,
|
|
|
|
|
+ '备注' => '产品工艺删除',
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1268,14 +1420,7 @@ class Product extends Api
|
|
|
$this->error('删除工艺详情失败');
|
|
$this->error('删除工艺详情失败');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 8. 记录操作日志(即使日志记录失败,也不影响主操作)
|
|
|
|
|
- if (!empty($logArray)) {
|
|
|
|
|
- $logResult = Db::name('系统操作日志表')->insertAll($logArray);
|
|
|
|
|
- if ($logResult === false) {
|
|
|
|
|
- // 记录日志失败,但不影响主操作
|
|
|
|
|
- \think\Log::write('记录操作日志失败: ' . Db::name('系统操作日志表')->getLastSql());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $this->saveProductOperateLog($logArray);
|
|
|
|
|
|
|
|
// 9. 返回成功
|
|
// 9. 返回成功
|
|
|
$this->success('成功删除 ' . $deleteResult . ' 条工艺详情');
|
|
$this->success('成功删除 ' . $deleteResult . ' 条工艺详情');
|
|
@@ -1296,8 +1441,23 @@ class Product extends Api
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
$printId = explode(',',$param['UniqId']);
|
|
$printId = explode(',',$param['UniqId']);
|
|
|
|
|
+ $printRows = \db('产品_印件资料')->where('UniqID','in',$printId)->select();
|
|
|
$res = \db('产品_印件资料')->where('UniqID','in',$printId)->delete();
|
|
$res = \db('产品_印件资料')->where('UniqID','in',$printId)->delete();
|
|
|
if ($res){
|
|
if ($res){
|
|
|
|
|
+ $logs = [];
|
|
|
|
|
+ foreach ($printRows as $row) {
|
|
|
|
|
+ $logs[] = [
|
|
|
|
|
+ '产品编号' => isset($row['yj_cpdh']) ? $row['yj_cpdh'] : '',
|
|
|
|
|
+ '产品名称' => isset($row['yj_yjmc']) ? $row['yj_yjmc'] : '',
|
|
|
|
|
+ '印件号' => isset($row['yj_yjno']) ? $row['yj_yjno'] : '',
|
|
|
|
|
+ '业务表' => '产品_印件资料',
|
|
|
|
|
+ 'RecordUniqid' => isset($row['UniqId']) ? $row['UniqId'] : (isset($row['UniqID']) ? $row['UniqID'] : ''),
|
|
|
|
|
+ '操作类型' => '删除',
|
|
|
|
|
+ '修改前' => isset($row['yj_yjmc']) ? trim((string)$row['yj_yjmc']) : '',
|
|
|
|
|
+ 'sys_id' => $this->getProductLogOperator($param),
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->saveProductOperateLog($logs);
|
|
|
$this->success('删除成功');
|
|
$this->success('删除成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('删除失败');
|
|
$this->error('删除失败');
|
|
@@ -1324,9 +1484,18 @@ class Product extends Api
|
|
|
$params['UniqID'] = $uniqId + 1;
|
|
$params['UniqID'] = $uniqId + 1;
|
|
|
}
|
|
}
|
|
|
$params['Sys_rq'] = date('Y-m-d H:i:s');
|
|
$params['Sys_rq'] = date('Y-m-d H:i:s');
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params);
|
|
|
$sql = \db('产品_基本资料')->fetchSql(true)->insert($params);
|
|
$sql = \db('产品_基本资料')->fetchSql(true)->insert($params);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $this->saveProductOperateLog([[
|
|
|
|
|
+ '产品编号' => isset($params['产品编号']) ? $params['产品编号'] : '',
|
|
|
|
|
+ '产品名称' => isset($params['产品名称']) ? $params['产品名称'] : '',
|
|
|
|
|
+ '业务表' => '产品_基本资料',
|
|
|
|
|
+ 'RecordUniqid' => $params['UniqID'],
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ]]);
|
|
|
$this->success('新增成功');
|
|
$this->success('新增成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('新增失败');
|
|
$this->error('新增失败');
|
|
@@ -1348,13 +1517,15 @@ class Product extends Api
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
$WorkOrderId = explode(',',$param['UniqId']);
|
|
$WorkOrderId = explode(',',$param['UniqId']);
|
|
|
|
|
+ $operator = $this->getProductLogOperator($param);
|
|
|
$i = 0;
|
|
$i = 0;
|
|
|
|
|
+ $logs = [];
|
|
|
foreach ($WorkOrderId as $key=>$value){
|
|
foreach ($WorkOrderId as $key=>$value){
|
|
|
- //获取产品编号
|
|
|
|
|
- $product = \db('产品_基本资料')
|
|
|
|
|
|
|
+ $productRow = \db('产品_基本资料')
|
|
|
->where('UniqID',$value)
|
|
->where('UniqID',$value)
|
|
|
- ->value('rtrim(产品编号)');
|
|
|
|
|
- //删除工单资料、工艺资料、印件资料
|
|
|
|
|
|
|
+ ->field('rtrim(产品编号) as 产品编号,rtrim(产品名称) as 产品名称')
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ $product = empty($productRow['产品编号']) ? '' : $productRow['产品编号'];
|
|
|
\db()->startTrans();
|
|
\db()->startTrans();
|
|
|
try {
|
|
try {
|
|
|
\db('产品_基本资料')->where('UniqID',$value)->delete();
|
|
\db('产品_基本资料')->where('UniqID',$value)->delete();
|
|
@@ -1365,11 +1536,21 @@ class Product extends Api
|
|
|
\db('产品_印件资料')->where('yj_cpdh',$product)->delete();
|
|
\db('产品_印件资料')->where('yj_cpdh',$product)->delete();
|
|
|
}
|
|
}
|
|
|
\db()->commit();
|
|
\db()->commit();
|
|
|
|
|
+ $logs[] = [
|
|
|
|
|
+ '产品编号' => $product,
|
|
|
|
|
+ '产品名称' => empty($productRow['产品名称']) ? '' : $productRow['产品名称'],
|
|
|
|
|
+ '业务表' => '产品_基本资料',
|
|
|
|
|
+ 'RecordUniqid' => $value,
|
|
|
|
|
+ '操作类型' => '删除',
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ '备注' => '同时删除该产品工艺资料和印件资料',
|
|
|
|
|
+ ];
|
|
|
}catch (\Exception $e){
|
|
}catch (\Exception $e){
|
|
|
\db()->rollback();
|
|
\db()->rollback();
|
|
|
$i++;
|
|
$i++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveProductOperateLog($logs);
|
|
|
if ($i === 0){
|
|
if ($i === 0){
|
|
|
$this->success('删除成功');
|
|
$this->success('删除成功');
|
|
|
}else{
|
|
}else{
|
|
@@ -1434,15 +1615,18 @@ class Product extends Api
|
|
|
$updateData[$key] = $newValue;
|
|
$updateData[$key] = $newValue;
|
|
|
|
|
|
|
|
$logArray[] = [
|
|
$logArray[] = [
|
|
|
- 'Gd_gdbh' => $processDetail['Gy0_cpdh'] ?? '',
|
|
|
|
|
- 'yjno' => $processDetail['Gy0_yjno'] ?? '',
|
|
|
|
|
- 'gxh' => $processDetail['Gy0_gxh'] ?? '',
|
|
|
|
|
- 'ModifyUser' => $modifyUser,
|
|
|
|
|
- 'ModifyTime' => $currentTime,
|
|
|
|
|
- 'FieldName' => $key,
|
|
|
|
|
- 'OldValue' => $oldValue,
|
|
|
|
|
- 'NewValue' => $newValue,
|
|
|
|
|
- 'ModifySource' => '产品工艺调整'
|
|
|
|
|
|
|
+ '产品编号' => $processDetail['Gy0_cpdh'] ?? '',
|
|
|
|
|
+ '印件号' => $processDetail['Gy0_yjno'] ?? '',
|
|
|
|
|
+ '工序号' => $processDetail['Gy0_gxh'] ?? '',
|
|
|
|
|
+ '方案' => $processDetail['Gy0_方案'] ?? '',
|
|
|
|
|
+ '业务表' => '产品_工艺资料',
|
|
|
|
|
+ 'RecordUniqid' => $uniqId,
|
|
|
|
|
+ '操作类型' => '修改',
|
|
|
|
|
+ '字段名' => $key,
|
|
|
|
|
+ '修改前' => $oldValue,
|
|
|
|
|
+ '修改后' => $newValue,
|
|
|
|
|
+ 'sys_id' => $modifyUser,
|
|
|
|
|
+ '备注' => '产品工艺调整',
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1470,16 +1654,7 @@ class Product extends Api
|
|
|
$this->error('更新产品工艺资料失败');
|
|
$this->error('更新产品工艺资料失败');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 11. 记录操作日志(即使日志记录失败,也不影响主操作)
|
|
|
|
|
- if (!empty($logArray)) {
|
|
|
|
|
- $logResult = Db::name('系统操作日志表')
|
|
|
|
|
- ->insertAll($logArray);
|
|
|
|
|
-
|
|
|
|
|
- if ($logResult === false) {
|
|
|
|
|
- // 记录日志失败,但不影响主操作
|
|
|
|
|
- \think\Log::write('记录操作日志失败: ' . Db::name('系统操作日志表')->getLastSql());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $this->saveProductOperateLog($logArray);
|
|
|
|
|
|
|
|
// 12. 返回成功
|
|
// 12. 返回成功
|
|
|
$this->success('修改成功');
|
|
$this->success('修改成功');
|
|
@@ -1545,6 +1720,8 @@ class Product extends Api
|
|
|
->where($where)
|
|
->where($where)
|
|
|
->order('Gy0_gxh,Sys_rq desc,Mod_rq desc')
|
|
->order('Gy0_gxh,Sys_rq desc,Mod_rq desc')
|
|
|
->column('Gy0_gxh', 'UniqID');
|
|
->column('Gy0_gxh', 'UniqID');
|
|
|
|
|
+ $operator = $this->getProductLogOperator($param);
|
|
|
|
|
+ $logs = [];
|
|
|
// 更新排序字段
|
|
// 更新排序字段
|
|
|
$i = 1;
|
|
$i = 1;
|
|
|
foreach ($list as $key => $value) {
|
|
foreach ($list as $key => $value) {
|
|
@@ -1554,13 +1731,131 @@ class Product extends Api
|
|
|
->update(['Gy0_gxh' => $i]);
|
|
->update(['Gy0_gxh' => $i]);
|
|
|
|
|
|
|
|
if ($result !== false) {
|
|
if ($result !== false) {
|
|
|
|
|
+ if ((string)$value !== (string)$i) {
|
|
|
|
|
+ $logs[] = [
|
|
|
|
|
+ '产品编号' => $param['cpdh'],
|
|
|
|
|
+ '印件号' => $param['yjno'],
|
|
|
|
|
+ '工序号' => $i,
|
|
|
|
|
+ '业务表' => '产品_工艺资料',
|
|
|
|
|
+ 'RecordUniqid' => $key,
|
|
|
|
|
+ '操作类型' => '排序',
|
|
|
|
|
+ '字段名' => 'Gy0_gxh',
|
|
|
|
|
+ '修改前' => $value,
|
|
|
|
|
+ '修改后' => $i,
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
$i++;
|
|
$i++;
|
|
|
} else {
|
|
} else {
|
|
|
- // 记录失败日志
|
|
|
|
|
\think\facade\Log::error("更新排序失败,UniqID: {$key}");
|
|
\think\facade\Log::error("更新排序失败,UniqID: {$key}");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveProductOperateLog($logs);
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 批量参数里取操作人,列表请求可能把 sys_id 放在首条或外层
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function pickProductLogOperator($params)
|
|
|
|
|
+ {
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params);
|
|
|
|
|
+ if ($operator === '' && isset($params[0]) && is_array($params[0])) {
|
|
|
|
|
+ $operator = $this->getProductLogOperator($params[0]);
|
|
|
|
|
+ }
|
|
|
|
|
+ return $operator;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 读取操作人,兼容 sys_id / Sys_id
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function getProductLogOperator($params)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!is_array($params)) {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isset($params['sys_id']) && $params['sys_id'] !== '') {
|
|
|
|
|
+ return trim((string)$params['sys_id']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isset($params['Sys_id']) && $params['Sys_id'] !== '') {
|
|
|
|
|
+ return trim((string)$params['Sys_id']);
|
|
|
|
|
+ }
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 工艺资料日志的公共字段
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function gyLogBase(array $old, $uniqId, $operator)
|
|
|
|
|
+ {
|
|
|
|
|
+ return [
|
|
|
|
|
+ '产品编号' => isset($old['Gy0_cpdh']) ? trim((string)$old['Gy0_cpdh']) : '',
|
|
|
|
|
+ '印件号' => isset($old['Gy0_yjno']) ? $old['Gy0_yjno'] : '',
|
|
|
|
|
+ '工序号' => isset($old['Gy0_gxh']) ? $old['Gy0_gxh'] : '',
|
|
|
|
|
+ '方案' => isset($old['Gy0_方案']) ? $old['Gy0_方案'] : '',
|
|
|
|
|
+ '业务表' => '产品_工艺资料',
|
|
|
|
|
+ 'RecordUniqid' => $uniqId,
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按字段对比生成修改日志
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function buildProductFieldChangeLogs(array $old, array $new, array $base)
|
|
|
|
|
+ {
|
|
|
|
|
+ $skip = ['sys_id', 'Sys_id', 'sys_rq', 'Sys_rq', 'mod_rq', 'Mod_rq', 'UniqId', 'UniqID'];
|
|
|
|
|
+ $logs = [];
|
|
|
|
|
+ foreach ($new as $field => $newValue) {
|
|
|
|
|
+ if (in_array($field, $skip, true) || !array_key_exists($field, $old)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (trim((string)$old[$field]) === trim((string)$newValue)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ $logs[] = array_merge($base, [
|
|
|
|
|
+ '操作类型' => isset($base['操作类型']) ? $base['操作类型'] : '修改',
|
|
|
|
|
+ '字段名' => $field,
|
|
|
|
|
+ '修改前' => trim((string)$old[$field]),
|
|
|
|
|
+ '修改后' => trim((string)$newValue),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+ return $logs;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 写入产品操作日志,失败不影响主操作
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function saveProductOperateLog(array $rows)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (empty($rows)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ $now = date('Y-m-d H:i:s');
|
|
|
|
|
+ $logs = [];
|
|
|
|
|
+ foreach ($rows as $row) {
|
|
|
|
|
+ $logs[] = [
|
|
|
|
|
+ '产品编号' => isset($row['产品编号']) ? $row['产品编号'] : '',
|
|
|
|
|
+ '产品名称' => isset($row['产品名称']) ? $row['产品名称'] : '',
|
|
|
|
|
+ '印件号' => isset($row['印件号']) ? $row['印件号'] : '',
|
|
|
|
|
+ '工序号' => isset($row['工序号']) ? $row['工序号'] : '',
|
|
|
|
|
+ '方案' => isset($row['方案']) ? $row['方案'] : '',
|
|
|
|
|
+ '业务表' => isset($row['业务表']) ? $row['业务表'] : '',
|
|
|
|
|
+ 'RecordUniqid' => isset($row['RecordUniqid']) ? $row['RecordUniqid'] : '',
|
|
|
|
|
+ '操作类型' => isset($row['操作类型']) ? $row['操作类型'] : '',
|
|
|
|
|
+ '字段名' => isset($row['字段名']) ? $row['字段名'] : '',
|
|
|
|
|
+ '修改前' => isset($row['修改前']) ? $row['修改前'] : '',
|
|
|
|
|
+ '修改后' => isset($row['修改后']) ? $row['修改后'] : '',
|
|
|
|
|
+ 'sys_id' => isset($row['sys_id']) ? $row['sys_id'] : '',
|
|
|
|
|
+ 'sys_rq' => $now,
|
|
|
|
|
+ '备注' => isset($row['备注']) ? $row['备注'] : '',
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ \db('产品_操作日志')->insertAll($logs);
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
|
+ \think\Log::write('记录产品操作日志失败: ' . $e->getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|