|
@@ -32,11 +32,6 @@ class Facility extends Api
|
|
|
$this->error('请求错误');
|
|
$this->error('请求错误');
|
|
|
}
|
|
}
|
|
|
$param = $this->request->param();
|
|
$param = $this->request->param();
|
|
|
-// if (isset($param['sort'])){
|
|
|
|
|
-// $where['使用部门'] = '智能车间';
|
|
|
|
|
-// }else{
|
|
|
|
|
-// $where['使用部门'] = ['<>','智能车间'];
|
|
|
|
|
-// }
|
|
|
|
|
$data = [];
|
|
$data = [];
|
|
|
$date = date('Y-m-d 00:00:00',time()-3888000);
|
|
$date = date('Y-m-d 00:00:00',time()-3888000);
|
|
|
$department = \db('设备_基本资料')
|
|
$department = \db('设备_基本资料')
|
|
@@ -44,7 +39,6 @@ class Facility extends Api
|
|
|
->where('使用部门','<>','研发中心')
|
|
->where('使用部门','<>','研发中心')
|
|
|
->where('设备编组','<>','')
|
|
->where('设备编组','<>','')
|
|
|
->where('sys_sbID','<>','')
|
|
->where('sys_sbID','<>','')
|
|
|
-// ->where($where)
|
|
|
|
|
->order('设备编组')
|
|
->order('设备编组')
|
|
|
->column('rtrim(使用部门) as 使用部门');
|
|
->column('rtrim(使用部门) as 使用部门');
|
|
|
if (empty($department)){
|
|
if (empty($department)){
|
|
@@ -242,7 +236,6 @@ class Facility extends Api
|
|
|
$this->error('请求错误');
|
|
$this->error('请求错误');
|
|
|
}
|
|
}
|
|
|
$machine = input('machine');
|
|
$machine = input('machine');
|
|
|
-// $date = input('date');
|
|
|
|
|
// 获取当前时间
|
|
// 获取当前时间
|
|
|
$current_time = time();
|
|
$current_time = time();
|
|
|
// 设置时间范围
|
|
// 设置时间范围
|
|
@@ -403,7 +396,6 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
$orderList = \db('工单_工艺资料')
|
|
$orderList = \db('工单_工艺资料')
|
|
|
->alias('a')
|
|
->alias('a')
|
|
|
-// ->join('设备_产量计酬 b','a.Gy0_gdbh = b.sczl_gdbh AND a.Gy0_yjno = b.sczl_yjno AND a.Gy0_gxh = b.sczl_gxh','LEFT')
|
|
|
|
|
->join('工单_基本资料 c','a.Gy0_gdbh = c.Gd_gdbh')
|
|
->join('工单_基本资料 c','a.Gy0_gdbh = c.Gd_gdbh')
|
|
|
->join('工单_印件资料 d','a.Gy0_gdbh = d.Yj_Gdbh AND a.Gy0_yjno = d.yj_Yjno')
|
|
->join('工单_印件资料 d','a.Gy0_gdbh = d.Yj_Gdbh AND a.Gy0_yjno = d.yj_Yjno')
|
|
|
->field('a.Gy0_gdbh as gdbh,rtrim(a.质量要求) as 质量信息,a.Gy0_yjno as yjno,a.Gy0_gxh as gxh,a.Gy0_sbbh as sbbh,
|
|
->field('a.Gy0_gdbh as gdbh,rtrim(a.质量要求) as 质量信息,a.Gy0_yjno as yjno,a.Gy0_gxh as gxh,a.Gy0_sbbh as sbbh,
|
|
@@ -732,12 +724,24 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $operator = $this->facilityLogOperator($param);
|
|
|
|
|
+ unset($param['sys_id'], $param['Sys_id']);
|
|
|
$param['sys_rq'] = date('Y-m-d H:i:s',time());
|
|
$param['sys_rq'] = date('Y-m-d H:i:s',time());
|
|
|
$param['UniqId'] = $lastId + 1;
|
|
$param['UniqId'] = $lastId + 1;
|
|
|
$param['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
$param['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
$sql = \db('设备_班组资料')->fetchSql(true)->insert($param);
|
|
$sql = \db('设备_班组资料')->fetchSql(true)->insert($param);
|
|
|
$res = \db()->query($sql);
|
|
$res = \db()->query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $this->saveFacilityOperateLog([[
|
|
|
|
|
+ '业务表' => '设备_班组资料',
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ '方法名' => 'MachineTeamAdd',
|
|
|
|
|
+ 'RecordUniqid' => $param['UniqId'],
|
|
|
|
|
+ '设备编号' => isset($param['sczl_jtbh']) ? $param['sczl_jtbh'] : '',
|
|
|
|
|
+ '班组编号' => isset($param['sczl_bzdh']) ? $param['sczl_bzdh'] : '',
|
|
|
|
|
+ '修改后' => $this->facilityTeamMemberText($param),
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ]]);
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
@@ -783,9 +787,10 @@ class Facility extends Api
|
|
|
if (empty($param)){
|
|
if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
- $machine = \db('设备_班组资料')
|
|
|
|
|
|
|
+ $teamRow = \db('设备_班组资料')
|
|
|
->where('UniqId',$param['UniqId'])
|
|
->where('UniqId',$param['UniqId'])
|
|
|
- ->value('sczl_jtbh');
|
|
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ $machine = isset($teamRow['sczl_jtbh']) ? $teamRow['sczl_jtbh'] : '';
|
|
|
$teamId = \db('设备_产量采集')
|
|
$teamId = \db('设备_产量采集')
|
|
|
->where('设备编号',$machine)
|
|
->where('设备编号',$machine)
|
|
|
->order('UniqId desc')
|
|
->order('UniqId desc')
|
|
@@ -797,6 +802,18 @@ class Facility extends Api
|
|
|
->where('UniqId',$param['UniqId'])
|
|
->where('UniqId',$param['UniqId'])
|
|
|
->delete();
|
|
->delete();
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ if ($res && !empty($teamRow)) {
|
|
|
|
|
+ $this->saveFacilityOperateLog([[
|
|
|
|
|
+ '业务表' => '设备_班组资料',
|
|
|
|
|
+ '操作类型' => '删除',
|
|
|
|
|
+ '方法名' => 'teamDel',
|
|
|
|
|
+ 'RecordUniqid' => $param['UniqId'],
|
|
|
|
|
+ '设备编号' => $machine,
|
|
|
|
|
+ '班组编号' => isset($teamRow['sczl_bzdh']) ? $teamRow['sczl_bzdh'] : '',
|
|
|
|
|
+ '修改前' => $this->facilityTeamMemberText($teamRow),
|
|
|
|
|
+ 'sys_id' => $this->facilityLogOperator($param),
|
|
|
|
|
+ ]]);
|
|
|
|
|
+ }
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
@@ -822,15 +839,6 @@ class Facility extends Api
|
|
|
if (empty($param)){
|
|
if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
-// $date = date('Y-m-d H:i:s',time());
|
|
|
|
|
-// if (empty($param['start'])){
|
|
|
|
|
-// $startTime = date('Y-m-d 08:30:00',time());
|
|
|
|
|
-// }else{
|
|
|
|
|
-// $startTime = date('Y-m-d H:i:s',strtotime($param['start']));
|
|
|
|
|
-// }
|
|
|
|
|
-// if ($date<$startTime){
|
|
|
|
|
-// $startTime = date('Y-m-d H:i:s',strtotime($startTime)-86400);
|
|
|
|
|
-// }
|
|
|
|
|
// 获取当前时间
|
|
// 获取当前时间
|
|
|
$current_time = time();
|
|
$current_time = time();
|
|
|
// 设置时间范围
|
|
// 设置时间范围
|
|
@@ -923,6 +931,21 @@ class Facility extends Api
|
|
|
$sql = \db('制程检验_记录')->fetchSql(true)->insert($data);
|
|
$sql = \db('制程检验_记录')->fetchSql(true)->insert($data);
|
|
|
$res = Db::query($sql);
|
|
$res = Db::query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $this->saveFacilityOperateLog([[
|
|
|
|
|
+ '业务表' => '制程检验_记录',
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ '方法名' => 'FieldInspectionRecordAdd',
|
|
|
|
|
+ 'RecordUniqid' => $data['UniqId'],
|
|
|
|
|
+ '设备编号' => $data['设备编号'],
|
|
|
|
|
+ '班组编号' => $data['班组编号'],
|
|
|
|
|
+ '工单编号' => $data['工单编号'],
|
|
|
|
|
+ '印件号' => $data['印件号'],
|
|
|
|
|
+ '工序号' => $param['processCode'],
|
|
|
|
|
+ '工序名称' => $data['工序名称'],
|
|
|
|
|
+ '修改后' => '类别='.$data['类别'].';检验人='.$data['检验项目'].';备注='.$data['检验备注'],
|
|
|
|
|
+ 'sys_id' => $this->facilityLogOperator($param),
|
|
|
|
|
+ '备注' => '检验人='.$param['employeeCode'].'/'.$param['employeeName'],
|
|
|
|
|
+ ]]);
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
@@ -1029,6 +1052,20 @@ class Facility extends Api
|
|
|
$res = \db('设备_点检记录')->insertAll($row);
|
|
$res = \db('设备_点检记录')->insertAll($row);
|
|
|
|
|
|
|
|
if ($res !== false) {
|
|
if ($res !== false) {
|
|
|
|
|
+ $logs = [];
|
|
|
|
|
+ foreach ($row as $item) {
|
|
|
|
|
+ $logs[] = [
|
|
|
|
|
+ '业务表' => '设备_点检记录',
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ '方法名' => 'InspectionItemAdd',
|
|
|
|
|
+ '设备编号' => $item['点检设备'],
|
|
|
|
|
+ '班组编号' => $item['班组编号'],
|
|
|
|
|
+ '修改后' => '部件='.$item['部件名称'].';项目='.$item['检验项目'].';结果='.$item['点检结果'],
|
|
|
|
|
+ 'sys_id' => $this->facilityLogOperator($param),
|
|
|
|
|
+ '备注' => '本次提交'.count($row).'条',
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
$this->success('添加成功,添加了' . count($row) . '条记录');
|
|
$this->success('添加成功,添加了' . count($row) . '条记录');
|
|
|
} else {
|
|
} else {
|
|
|
$this->error('添加失败');
|
|
$this->error('添加失败');
|
|
@@ -1651,7 +1688,6 @@ class Facility extends Api
|
|
|
/*
|
|
/*
|
|
|
* 系统提交时间(应报工时间)和开工时间
|
|
* 系统提交时间(应报工时间)和开工时间
|
|
|
*/
|
|
*/
|
|
|
-// $startTime = $startTime['开工时间'];
|
|
|
|
|
$rqTime = isset($param[0]['rq']) ? $param[0]['rq'] : date('Y-m-d H:i:s');
|
|
$rqTime = isset($param[0]['rq']) ? $param[0]['rq'] : date('Y-m-d H:i:s');
|
|
|
//转换为时间戳
|
|
//转换为时间戳
|
|
|
$rqTimestamp = strtotime($rqTime);
|
|
$rqTimestamp = strtotime($rqTime);
|
|
@@ -1673,12 +1709,6 @@ class Facility extends Api
|
|
|
if ($minutes > 0) $formattedDiff .= $minutes . "分钟";
|
|
if ($minutes > 0) $formattedDiff .= $minutes . "分钟";
|
|
|
if ($seconds > 0) $formattedDiff .= $seconds . "秒";
|
|
if ($seconds > 0) $formattedDiff .= $seconds . "秒";
|
|
|
|
|
|
|
|
- //测试进行时间比较,查看时间判断是否正确
|
|
|
|
|
-// echo "<pre>";
|
|
|
|
|
-// print_r("系统提交时间:" .$rqTime);
|
|
|
|
|
-// print_r("\n当前开工时间:" . $startTime);
|
|
|
|
|
-// print_r("\n时间差:" . $formattedDiff);
|
|
|
|
|
-// echo "<pre>";
|
|
|
|
|
|
|
|
|
|
// 判断是否超过 12 小时(12 * 3600 = 43200 秒)
|
|
// 判断是否超过 12 小时(12 * 3600 = 43200 秒)
|
|
|
if ($timeDiff > 43200) {
|
|
if ($timeDiff > 43200) {
|
|
@@ -1723,6 +1753,26 @@ class Facility extends Api
|
|
|
|
|
|
|
|
$res = \db('制程检验_记录')->insertAll($data);
|
|
$res = \db('制程检验_记录')->insertAll($data);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $operator = $this->facilityLogOperator(isset($param[0]) ? $param[0] : $param);
|
|
|
|
|
+ $logs = [];
|
|
|
|
|
+ foreach ($data as $item) {
|
|
|
|
|
+ $logs[] = [
|
|
|
|
|
+ '业务表' => '制程检验_记录',
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ '方法名' => 'ProcessInspectionRecordsItemAdd',
|
|
|
|
|
+ 'RecordUniqid' => $item['UniqId'],
|
|
|
|
|
+ '设备编号' => $item['设备编号'],
|
|
|
|
|
+ '班组编号' => $item['班组编号'],
|
|
|
|
|
+ '工单编号' => $item['工单编号'],
|
|
|
|
|
+ '印件号' => $item['印件号'],
|
|
|
|
|
+ '工序号' => $process['gxh'],
|
|
|
|
|
+ '工序名称' => $item['工序名称'],
|
|
|
|
|
+ '修改后' => '类别='.$item['类别'].';项目='.$item['检验项目'].';结果='.$item['检验结果'],
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ '备注' => '本次提交'.count($data).'条',
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
@@ -1792,6 +1842,26 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
$res = \db('制程检验_记录附加')->insertAll($data);
|
|
$res = \db('制程检验_记录附加')->insertAll($data);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $operator = $this->facilityLogOperator(isset($param[0]) ? $param[0] : $param);
|
|
|
|
|
+ $logs = [];
|
|
|
|
|
+ foreach ($data as $item) {
|
|
|
|
|
+ $logs[] = [
|
|
|
|
|
+ '业务表' => '制程检验_记录附加',
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ '方法名' => 'AdditionalInspectionRecordAdd',
|
|
|
|
|
+ 'RecordUniqid' => $item['UniqId'],
|
|
|
|
|
+ '设备编号' => $item['设备编号'],
|
|
|
|
|
+ '班组编号' => $item['班组编号'],
|
|
|
|
|
+ '工单编号' => $item['工单编号'],
|
|
|
|
|
+ '印件号' => $item['印件号'],
|
|
|
|
|
+ '工序号' => $process['gxh'],
|
|
|
|
|
+ '工序名称' => $item['工序名称'],
|
|
|
|
|
+ '修改后' => '缺陷备注='.$item['缺陷备注'],
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ '备注' => '本次提交'.count($data).'条',
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
@@ -1867,24 +1937,8 @@ class Facility extends Api
|
|
|
$data['累计产量'] = $params['production_all'];
|
|
$data['累计产量'] = $params['production_all'];
|
|
|
$data['班组编号'] = $params['sczl_bzdh'];
|
|
$data['班组编号'] = $params['sczl_bzdh'];
|
|
|
$data['班组ID'] = $params['team_id'];
|
|
$data['班组ID'] = $params['team_id'];
|
|
|
-// // 获取当前时间
|
|
|
|
|
-// $current_time = time();
|
|
|
|
|
-// // 设置时间范围
|
|
|
|
|
-// $start_time1 = strtotime(date('Y-m-d') . ' 08:30:00');
|
|
|
|
|
-// $end_time1 = strtotime(date('Y-m-d') . ' 20:30:00');
|
|
|
|
|
-// $end_time2 = strtotime(date('Y-m-d') . ' 24:00:00');
|
|
|
|
|
-// $start_time3 = strtotime(date('Y-m-d', strtotime('+1 day')) . ' 08:30:00');
|
|
|
|
|
-// $start_time4 = strtotime(date('Y-m-d', strtotime('+1 day')) . ' 00:00:00');
|
|
|
|
|
-// // 判断当前时间属于哪个时间范围
|
|
|
|
|
-// if ($current_time >= $start_time1 && $current_time <= $end_time1) {
|
|
|
|
|
-// $data['开工时间'] = date('Y-m-d') . ' 08:30:00';
|
|
|
|
|
-// } elseif ($current_time > $end_time1 && $current_time <= $end_time2) {
|
|
|
|
|
-// $data['开工时间'] = date('Y-m-d') . ' 20:30:00';
|
|
|
|
|
-// } elseif ($current_time > $end_time1 && $current_time <= $start_time3) {
|
|
|
|
|
-// $data['开工时间'] = date('Y-m-d', strtotime('+1 day')) . ' 08:30:00';
|
|
|
|
|
-// }elseif ($current_time > $start_time4 && $current_time <= $start_time3){
|
|
|
|
|
-// $data['开工时间'] = date('Y-m-d') . ' 20:30:00';
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ // 获取当前时间
|
|
|
|
|
+
|
|
|
$current_time = time();
|
|
$current_time = time();
|
|
|
$today = date('Y-m-d');
|
|
$today = date('Y-m-d');
|
|
|
$tomorrow = date('Y-m-d', strtotime('+1 day'));
|
|
$tomorrow = date('Y-m-d', strtotime('+1 day'));
|
|
@@ -1921,6 +1975,20 @@ class Facility extends Api
|
|
|
if ($res === false) {
|
|
if ($res === false) {
|
|
|
$this->error('设置失败');
|
|
$this->error('设置失败');
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ $this->saveFacilityOperateLog([[
|
|
|
|
|
+ '业务表' => '设备_产量采集',
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ '方法名' => 'setMachineTeam',
|
|
|
|
|
+ 'RecordUniqid' => $data['UniqId'],
|
|
|
|
|
+ '设备编号' => $data['设备编号'],
|
|
|
|
|
+ '班组编号' => $data['班组编号'],
|
|
|
|
|
+ '工单编号' => $data['工单编号'],
|
|
|
|
|
+ '印件号' => $data['印件号'],
|
|
|
|
|
+ '工序号' => $data['工序号'],
|
|
|
|
|
+ '工序名称' => $data['工序名称'],
|
|
|
|
|
+ '修改后' => '状态='.$data['当前状态'].';当班产量='.$data['当班产量'].';累计产量='.$data['累计产量'].';开工时间='.$data['开工时间'],
|
|
|
|
|
+ 'sys_id' => $this->facilityLogOperator($params),
|
|
|
|
|
+ ]]);
|
|
|
$this->success('设置成功');
|
|
$this->success('设置成功');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2043,6 +2111,7 @@ class Facility extends Api
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
$lastId = \db('制程_换型清场')->order('UniqId desc')->value('UniqId');
|
|
$lastId = \db('制程_换型清场')->order('UniqId desc')->value('UniqId');
|
|
|
|
|
+ $operator = $this->facilityLogOperator($param);
|
|
|
$param['sys_id'] = '['.$param['机台编号'].']';
|
|
$param['sys_id'] = '['.$param['机台编号'].']';
|
|
|
$param['sys_rq'] = date('Y-m-d H:i:s',time());
|
|
$param['sys_rq'] = date('Y-m-d H:i:s',time());
|
|
|
$param['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
$param['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
@@ -2050,6 +2119,19 @@ class Facility extends Api
|
|
|
$sql = \db('制程_换型清场')->fetchSql(true)->insert($param);
|
|
$sql = \db('制程_换型清场')->fetchSql(true)->insert($param);
|
|
|
$res = \db()->query($sql);
|
|
$res = \db()->query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $this->saveFacilityOperateLog([[
|
|
|
|
|
+ '业务表' => '制程_换型清场',
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ '方法名' => 'remodelDataAdd',
|
|
|
|
|
+ 'RecordUniqid' => $param['UniqId'],
|
|
|
|
|
+ '设备编号' => isset($param['机台编号']) ? $param['机台编号'] : '',
|
|
|
|
|
+ '班组编号' => isset($param['班组']) ? $param['班组'] : '',
|
|
|
|
|
+ '工单编号' => isset($param['工单编号A']) ? $param['工单编号A'] : '',
|
|
|
|
|
+ '工序名称' => isset($param['印件工序A']) ? $param['印件工序A'] : '',
|
|
|
|
|
+ '修改后' => '工单A='.(isset($param['工单编号A']) ? $param['工单编号A'] : '').';工单B='.(isset($param['工单编号B']) ? $param['工单编号B'] : '').';机长='.(isset($param['机长']) ? $param['机长'] : ''),
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ '备注' => '业务表sys_id记为机台编号'.$param['sys_id'],
|
|
|
|
|
+ ]]);
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
@@ -2072,10 +2154,36 @@ class Facility extends Api
|
|
|
if (empty($param)){
|
|
if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
|
|
+ $operator = $this->facilityLogOperator($param);
|
|
|
|
|
+ $uniqId = '';
|
|
|
|
|
+ if (isset($param['UniqId'])) {
|
|
|
|
|
+ $uniqId = $param['UniqId'];
|
|
|
|
|
+ } elseif (isset($param['UniqID'])) {
|
|
|
|
|
+ $uniqId = $param['UniqID'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $before = [];
|
|
|
|
|
+ if ($uniqId !== '') {
|
|
|
|
|
+ $before = \db('制程_换型清场')->where('UniqId', $uniqId)->find();
|
|
|
|
|
+ if (empty($before)) {
|
|
|
|
|
+ $before = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
$param['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
$param['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
$sql = \db('制程_换型清场')->fetchSql(true)->update($param);
|
|
$sql = \db('制程_换型清场')->fetchSql(true)->update($param);
|
|
|
$res = \db()->query($sql);
|
|
$res = \db()->query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $base = [
|
|
|
|
|
+ '业务表' => '制程_换型清场',
|
|
|
|
|
+ '操作类型' => '修改',
|
|
|
|
|
+ '方法名' => 'remodelDataEdit',
|
|
|
|
|
+ 'RecordUniqid' => $uniqId,
|
|
|
|
|
+ '设备编号' => isset($before['机台编号']) ? $before['机台编号'] : (isset($param['机台编号']) ? $param['机台编号'] : ''),
|
|
|
|
|
+ '班组编号' => isset($before['班组']) ? $before['班组'] : (isset($param['班组']) ? $param['班组'] : ''),
|
|
|
|
|
+ '工单编号' => isset($before['工单编号A']) ? $before['工单编号A'] : (isset($param['工单编号A']) ? $param['工单编号A'] : ''),
|
|
|
|
|
+ '工序名称' => isset($before['印件工序A']) ? $before['印件工序A'] : (isset($param['印件工序A']) ? $param['印件工序A'] : ''),
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ];
|
|
|
|
|
+ $this->saveFacilityOperateLog($this->facilityChangedLogs($base, $before, $param));
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
@@ -2097,8 +2205,23 @@ class Facility extends Api
|
|
|
if (empty($param)){
|
|
if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
|
|
+ $before = \db('制程_换型清场')->where('UniqId',$param['UniqId'])->find();
|
|
|
$res = \db('制程_换型清场')->where('UniqId',$param['UniqId'])->delete();
|
|
$res = \db('制程_换型清场')->where('UniqId',$param['UniqId'])->delete();
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ if ($res && !empty($before)) {
|
|
|
|
|
+ $this->saveFacilityOperateLog([[
|
|
|
|
|
+ '业务表' => '制程_换型清场',
|
|
|
|
|
+ '操作类型' => '删除',
|
|
|
|
|
+ '方法名' => 'remodelDataDel',
|
|
|
|
|
+ 'RecordUniqid' => $param['UniqId'],
|
|
|
|
|
+ '设备编号' => isset($before['机台编号']) ? $before['机台编号'] : '',
|
|
|
|
|
+ '班组编号' => isset($before['班组']) ? $before['班组'] : '',
|
|
|
|
|
+ '工单编号' => isset($before['工单编号A']) ? $before['工单编号A'] : '',
|
|
|
|
|
+ '工序名称' => isset($before['印件工序A']) ? $before['印件工序A'] : '',
|
|
|
|
|
+ '修改前' => '工单A='.trim((string)$before['工单编号A']).';工单B='.trim((string)$before['工单编号B']).';机长='.trim((string)$before['机长']),
|
|
|
|
|
+ 'sys_id' => $this->facilityLogOperator($param),
|
|
|
|
|
+ ]]);
|
|
|
|
|
+ }
|
|
|
$this->success('删除成功');
|
|
$this->success('删除成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('删除失败');
|
|
$this->error('删除失败');
|
|
@@ -2129,6 +2252,23 @@ class Facility extends Api
|
|
|
$sql = \db('工单_印版领用记录')->fetchSql(true)->insertAll($param);
|
|
$sql = \db('工单_印版领用记录')->fetchSql(true)->insertAll($param);
|
|
|
$res = \db()->query($sql);
|
|
$res = \db()->query($sql);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
|
|
+ $logs = [];
|
|
|
|
|
+ foreach ($param as $item) {
|
|
|
|
|
+ if (!is_array($item)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ $logs[] = [
|
|
|
|
|
+ '业务表' => '工单_印版领用记录',
|
|
|
|
|
+ '操作类型' => '新增',
|
|
|
|
|
+ '方法名' => 'PrintDetailAdd',
|
|
|
|
|
+ 'RecordUniqid' => isset($item['UniqID']) ? $item['UniqID'] : (isset($item['UniqId']) ? $item['UniqId'] : ''),
|
|
|
|
|
+ '工单编号' => isset($item['Yb_工单编号']) ? $item['Yb_工单编号'] : '',
|
|
|
|
|
+ '修改后' => '供方批号='.(isset($item['Yb_供方批号']) ? $item['Yb_供方批号'] : '').';领用日期='.$item['Yb_领用日期'],
|
|
|
|
|
+ 'sys_id' => $this->facilityLogOperator($item),
|
|
|
|
|
+ '备注' => '本次领用'.count($param).'条',
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
$this->success('添加成功');
|
|
$this->success('添加成功');
|
|
|
}else{
|
|
}else{
|
|
|
$this->error('添加失败');
|
|
$this->error('添加失败');
|
|
@@ -2152,8 +2292,14 @@ class Facility extends Api
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
$idList = explode(',',$param['id']);
|
|
$idList = explode(',',$param['id']);
|
|
|
|
|
+ $operator = $this->facilityLogOperator($param);
|
|
|
$i = 0;
|
|
$i = 0;
|
|
|
|
|
+ $logs = [];
|
|
|
foreach ($idList as $key=>$value){
|
|
foreach ($idList as $key=>$value){
|
|
|
|
|
+ $before = \db('工单_印版领用记录')->where('UniqID',$value)->find();
|
|
|
|
|
+ if (empty($before)) {
|
|
|
|
|
+ $before = [];
|
|
|
|
|
+ }
|
|
|
$data['Yb_退还日期'] = date('Y-m-d H:i:s',time());
|
|
$data['Yb_退还日期'] = date('Y-m-d H:i:s',time());
|
|
|
$data['Mod_rq'] = date('Y-m-d H:i:s',time());
|
|
$data['Mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
$data['Yb_印数'] = $param['number'];
|
|
$data['Yb_印数'] = $param['number'];
|
|
@@ -2161,8 +2307,20 @@ class Facility extends Api
|
|
|
$res = \db()->query($sql);
|
|
$res = \db()->query($sql);
|
|
|
if ($res === false){
|
|
if ($res === false){
|
|
|
$i++;
|
|
$i++;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $base = [
|
|
|
|
|
+ '业务表' => '工单_印版领用记录',
|
|
|
|
|
+ '操作类型' => '修改',
|
|
|
|
|
+ '方法名' => 'PrintDetailEdit',
|
|
|
|
|
+ 'RecordUniqid' => $value,
|
|
|
|
|
+ '工单编号' => isset($before['Yb_工单编号']) ? $before['Yb_工单编号'] : '',
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ '备注' => '印版退还',
|
|
|
|
|
+ ];
|
|
|
|
|
+ $logs = array_merge($logs, $this->facilityChangedLogs($base, $before, $data));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
if ($i !== 0){
|
|
if ($i !== 0){
|
|
|
$this->error('退还失败');
|
|
$this->error('退还失败');
|
|
|
}else{
|
|
}else{
|
|
@@ -2177,30 +2335,6 @@ class Facility extends Api
|
|
|
* @throws \think\db\exception\BindParamException
|
|
* @throws \think\db\exception\BindParamException
|
|
|
* @throws \think\exception\PDOException
|
|
* @throws \think\exception\PDOException
|
|
|
*/
|
|
*/
|
|
|
-// public function chanliangEdit()
|
|
|
|
|
-// {
|
|
|
|
|
-// if (Request::instance()->isPost() === false){
|
|
|
|
|
-// $this->error('请求错误');
|
|
|
|
|
-// }
|
|
|
|
|
-// $param = Request::instance()->post();
|
|
|
|
|
-// if (empty($param['UniqId'])){
|
|
|
|
|
-// $this->error('参数错误');
|
|
|
|
|
-// }
|
|
|
|
|
-// $param['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
|
|
-// $data = $param;
|
|
|
|
|
-// unset($data['UniqId']);
|
|
|
|
|
-// unset($data['sczl_rq']);
|
|
|
|
|
-// $sql = \db('设备_产量计酬')
|
|
|
|
|
-// ->where('UniqId',$param['UniqId'])
|
|
|
|
|
-// ->fetchSql(true)
|
|
|
|
|
-// ->update($data);
|
|
|
|
|
-// $res = \db()->query($sql);
|
|
|
|
|
-// if ($res !== false){
|
|
|
|
|
-// $this->success('修改成功');
|
|
|
|
|
-// }else {
|
|
|
|
|
-// $this->error('修改失败');
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
public function chanliangEdit()
|
|
public function chanliangEdit()
|
|
|
{
|
|
{
|
|
|
// 使用更简洁的请求判断方式
|
|
// 使用更简洁的请求判断方式
|
|
@@ -2230,7 +2364,17 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$uniqId = $param['UniqId'];
|
|
$uniqId = $param['UniqId'];
|
|
|
|
|
+ $operator = $this->facilityLogOperator($param);
|
|
|
|
|
+ $beforeYield = \db('设备_产量计酬')->where('UniqId', $uniqId)->find();
|
|
|
|
|
+ $beforePlate = \db('设备_装版工时')->where('yieldUid', $uniqId)->order('Uniqid desc')->find();
|
|
|
|
|
+ if (empty($beforeYield)) {
|
|
|
|
|
+ $beforeYield = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ if (empty($beforePlate)) {
|
|
|
|
|
+ $beforePlate = [];
|
|
|
|
|
+ }
|
|
|
$success = false;
|
|
$success = false;
|
|
|
|
|
+ $plateData = [];
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
// 处理装版工时数据(如果存在)
|
|
// 处理装版工时数据(如果存在)
|
|
@@ -2241,6 +2385,7 @@ class Facility extends Api
|
|
|
'换版类型' => $param['换版类型'] ?? '',
|
|
'换版类型' => $param['换版类型'] ?? '',
|
|
|
'装版补产工时' => $param['sczl_装版工时'] ?? ''
|
|
'装版补产工时' => $param['sczl_装版工时'] ?? ''
|
|
|
];
|
|
];
|
|
|
|
|
+ $plateData = $priData;
|
|
|
|
|
|
|
|
$priSql = \db('设备_装版工时')->where('yieldUid', $uniqId)->fetchSql(true)->update($priData);
|
|
$priSql = \db('设备_装版工时')->where('yieldUid', $uniqId)->fetchSql(true)->update($priData);
|
|
|
\db()->query($priSql);
|
|
\db()->query($priSql);
|
|
@@ -2259,6 +2404,14 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($success) {
|
|
if ($success) {
|
|
|
|
|
+ $logs = $this->facilityChangedLogs($this->facilityYieldLogBase($beforeYield, '修改', 'chanliangEdit', $operator), $beforeYield, $updateData);
|
|
|
|
|
+ if (!empty($plateData)) {
|
|
|
|
|
+ $plateBase = $this->facilityYieldLogBase($beforeYield, '修改', 'chanliangEdit', $operator);
|
|
|
|
|
+ $plateBase['业务表'] = '设备_装版工时';
|
|
|
|
|
+ $plateBase['RecordUniqid'] = $uniqId;
|
|
|
|
|
+ $logs = array_merge($logs, $this->facilityChangedLogs($plateBase, $beforePlate, $plateData));
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
$this->success('修改成功');
|
|
$this->success('修改成功');
|
|
|
} else {
|
|
} else {
|
|
|
$this->error('修改失败,未更新任何数据');
|
|
$this->error('修改失败,未更新任何数据');
|
|
@@ -2357,45 +2510,6 @@ class Facility extends Api
|
|
|
* @throws \think\db\exception\BindParamException
|
|
* @throws \think\db\exception\BindParamException
|
|
|
* @throws \think\exception\PDOException
|
|
* @throws \think\exception\PDOException
|
|
|
*/
|
|
*/
|
|
|
-// public function MachineChanliangDetailEdit()
|
|
|
|
|
-// {
|
|
|
|
|
-// if (Request::instance()->isPost() === false){
|
|
|
|
|
-// $this->error('请求错误');
|
|
|
|
|
-// }
|
|
|
|
|
-// $param = Request::instance()->post();
|
|
|
|
|
-// if (empty($param['UniqId'])){
|
|
|
|
|
-// $this->error('参数错误');
|
|
|
|
|
-// }
|
|
|
|
|
-// $param['sczl_type'] = $param['sczl_gxmc'];
|
|
|
|
|
-// $param['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
|
|
-// $UnidId = $param['UniqId'];
|
|
|
|
|
-// unset($param['UniqId']);
|
|
|
|
|
-// unset($param['sczl_rq']);
|
|
|
|
|
-// if (!empty($param['sczl_装版总工时']) && $param['sczl_装版总工时'] !== 0){
|
|
|
|
|
-// $data = [
|
|
|
|
|
-// 'gdbh' => $param['sczl_gdbh'],
|
|
|
|
|
-// 'yjno' => $param['sczl_yjno'],
|
|
|
|
|
-// 'gxh' => $param['sczl_gxh'],
|
|
|
|
|
-// 'jtbh' => $param['sczl_jtbh'],
|
|
|
|
|
-// 'startTime' => $param['sczl_sj1'],
|
|
|
|
|
-// 'endTime' => $param['sczl_sj2'],
|
|
|
|
|
-// '换版总工时' => $param['sczl_装版总工时'],
|
|
|
|
|
-// '换版联拼数' => $param['sczl_换版联拼数'],
|
|
|
|
|
-// '换版类型' => $param['换版类型']
|
|
|
|
|
-// ];
|
|
|
|
|
-// $priSql = \db('设备_装版工时')->where('yieldUid')->fetchSql(true)->update($data);
|
|
|
|
|
-// $priRes = \db()->query($priSql);
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// $sql = \db('设备_产量计酬')->where('UniqId',$UnidId)->fetchSql(true)->update($param);
|
|
|
|
|
-// $res = \db()->query($sql);
|
|
|
|
|
-// if ($res !== false){
|
|
|
|
|
-// $this->success('修改成功');
|
|
|
|
|
-// }else{
|
|
|
|
|
-// $this->error('修改失败');
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
public function MachineChanliangDetailEdit()
|
|
public function MachineChanliangDetailEdit()
|
|
|
{
|
|
{
|
|
|
// 使用更简洁的请求判断方式
|
|
// 使用更简洁的请求判断方式
|
|
@@ -2426,7 +2540,17 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$uniqId = $param['UniqId'];
|
|
$uniqId = $param['UniqId'];
|
|
|
|
|
+ $operator = $this->facilityLogOperator($param);
|
|
|
|
|
+ $beforeYield = \db('设备_产量计酬')->where('UniqId', $uniqId)->find();
|
|
|
|
|
+ $beforePlate = \db('设备_装版工时')->where('yieldUid', $uniqId)->order('Uniqid desc')->find();
|
|
|
|
|
+ if (empty($beforeYield)) {
|
|
|
|
|
+ $beforeYield = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ if (empty($beforePlate)) {
|
|
|
|
|
+ $beforePlate = [];
|
|
|
|
|
+ }
|
|
|
$success = false;
|
|
$success = false;
|
|
|
|
|
+ $plateData = [];
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
// 处理装版工时数据(如果存在)
|
|
// 处理装版工时数据(如果存在)
|
|
@@ -2443,6 +2567,7 @@ class Facility extends Api
|
|
|
'换版类型' => $param['换版类型'] ?? '',
|
|
'换版类型' => $param['换版类型'] ?? '',
|
|
|
'装版补产工时' => $param['sczl_装版工时'] ?? ''
|
|
'装版补产工时' => $param['sczl_装版工时'] ?? ''
|
|
|
];
|
|
];
|
|
|
|
|
+ $plateData = $priData;
|
|
|
|
|
|
|
|
$priSql = \db('设备_装版工时')->where('yieldUid', $uniqId)->fetchSql(true)->update($priData);
|
|
$priSql = \db('设备_装版工时')->where('yieldUid', $uniqId)->fetchSql(true)->update($priData);
|
|
|
\db()->query($priSql);
|
|
\db()->query($priSql);
|
|
@@ -2461,6 +2586,14 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($success) {
|
|
if ($success) {
|
|
|
|
|
+ $logs = $this->facilityChangedLogs($this->facilityYieldLogBase($beforeYield, '修改', 'MachineChanliangDetailEdit', $operator), $beforeYield, $updateData);
|
|
|
|
|
+ if (!empty($plateData)) {
|
|
|
|
|
+ $plateBase = $this->facilityYieldLogBase($beforeYield, '修改', 'MachineChanliangDetailEdit', $operator);
|
|
|
|
|
+ $plateBase['业务表'] = '设备_装版工时';
|
|
|
|
|
+ $plateBase['RecordUniqid'] = $uniqId;
|
|
|
|
|
+ $logs = array_merge($logs, $this->facilityChangedLogs($plateBase, $beforePlate, $plateData));
|
|
|
|
|
+ }
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
$this->success('修改成功');
|
|
$this->success('修改成功');
|
|
|
} else {
|
|
} else {
|
|
|
$this->error('修改失败,未更新任何数据');
|
|
$this->error('修改失败,未更新任何数据');
|
|
@@ -2483,11 +2616,20 @@ class Facility extends Api
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
$idList = explode(',',$param['UniqId']);
|
|
$idList = explode(',',$param['UniqId']);
|
|
|
|
|
+ $operator = $this->facilityLogOperator($param);
|
|
|
|
|
+ $logs = [];
|
|
|
foreach ($idList as $key=>$value){
|
|
foreach ($idList as $key=>$value){
|
|
|
|
|
+ $before = \db('设备_产量计酬')->where('UniqId',$value)->find();
|
|
|
$res = \db('设备_产量计酬')
|
|
$res = \db('设备_产量计酬')
|
|
|
->where('UniqId',$value)
|
|
->where('UniqId',$value)
|
|
|
->delete();
|
|
->delete();
|
|
|
|
|
+ if ($res && !empty($before)) {
|
|
|
|
|
+ $item = $this->facilityYieldLogBase($before, '删除', 'ChanliangDel', $operator);
|
|
|
|
|
+ $item['修改前'] = '产量='.trim((string)$before['sczl_cl']).';制程废品='.trim((string)$before['sczl_zcfp']);
|
|
|
|
|
+ $logs[] = $item;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
if ($res !== false){
|
|
if ($res !== false){
|
|
|
$this->success('删除成功');
|
|
$this->success('删除成功');
|
|
|
}else{
|
|
}else{
|
|
@@ -2501,57 +2643,6 @@ class Facility extends Api
|
|
|
* @throws \think\db\exception\BindParamException
|
|
* @throws \think\db\exception\BindParamException
|
|
|
* @throws \think\exception\PDOException
|
|
* @throws \think\exception\PDOException
|
|
|
*/
|
|
*/
|
|
|
-// public function ChanliangAdd()
|
|
|
|
|
-// {
|
|
|
|
|
-// if (Request::instance()->isPost() === false){
|
|
|
|
|
-// $this->error('请求错误');
|
|
|
|
|
-// }
|
|
|
|
|
-// $params = Request::instance()->post();
|
|
|
|
|
-// if (empty($params['sczl_gdbh'])){
|
|
|
|
|
-// $this->error('参数错误');
|
|
|
|
|
-// }
|
|
|
|
|
-// $lastId = \db('设备_产量计酬')->order('UniqId desc')->value('rtrim(UniqId)');
|
|
|
|
|
-// $massage = \db('工单_工艺资料')
|
|
|
|
|
-// ->where('Gy0_gdbh',$params['sczl_gdbh'])
|
|
|
|
|
-// ->where('Gy0_yjno',$params['sczl_yjno'])
|
|
|
|
|
-// ->where('Gy0_gxh',$params['sczl_gxh'])
|
|
|
|
|
-// ->count();
|
|
|
|
|
-// if ($massage === 0){
|
|
|
|
|
-// $this->error('请选择正确的工序');
|
|
|
|
|
-// }
|
|
|
|
|
-// $params['sczl_type'] = $params['sczl_gxmc'];
|
|
|
|
|
-// $params['sczl_wgsj'] = '1900-01-01 00:00:00';
|
|
|
|
|
-// $params['sczl_废品率系数'] = 0;
|
|
|
|
|
-// $params['sys_rq'] = date('Y-m-d H:i:s',time());
|
|
|
|
|
-// $params['mod_rq'] = date('Y-m-d H:i:s',time());
|
|
|
|
|
-// $params['UniqId'] = $lastId + 1;
|
|
|
|
|
-// if (!empty($params['sczl_装版总工时']) && $params['sczl_装版总工时'] !== 0){
|
|
|
|
|
-// $data = [
|
|
|
|
|
-// 'gdbh' => $params['sczl_gdbh'],
|
|
|
|
|
-// 'yjno' => $params['sczl_yjno'],
|
|
|
|
|
-// 'gxh' => $params['sczl_gxh'],
|
|
|
|
|
-// 'jtbh' => $params['sczl_jtbh'],
|
|
|
|
|
-// 'startTime' => $params['sczl_sj1'],
|
|
|
|
|
-// 'endTime' => $params['sczl_sj2'],
|
|
|
|
|
-// 'yieldUid' => $params['UniqId'],
|
|
|
|
|
-// '换版总工时' => $params['sczl_装版总工时'],
|
|
|
|
|
-// '换版联拼数' => $params['sczl_换版联拼数'],
|
|
|
|
|
-// '换版类型' => $params['换版类型'],
|
|
|
|
|
-// 'sys_rq' => date('Y-m-d H:i:s',time()),
|
|
|
|
|
-// 'sys_id' => $params['sys_id']
|
|
|
|
|
-// ];
|
|
|
|
|
-// $chSql = \db('设备_装版工时')->fetchSql(true)->insert($data);
|
|
|
|
|
-// $chRes = \db()->query($chSql);
|
|
|
|
|
-// }
|
|
|
|
|
-// unset($params['sczl_换版联拼数'],$params['换版类型']);
|
|
|
|
|
-// $sql = \db('设备_产量计酬')->fetchSql(true)->insert($params);
|
|
|
|
|
-// $res = \db()->query($sql);
|
|
|
|
|
-// if ($res !== false){
|
|
|
|
|
-// $this->success('成功');
|
|
|
|
|
-// }else{
|
|
|
|
|
-// $this->error('失败');
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
public function ChanliangAdd()
|
|
public function ChanliangAdd()
|
|
|
{
|
|
{
|
|
|
// 1. 请求验证
|
|
// 1. 请求验证
|
|
@@ -2617,6 +2708,10 @@ class Facility extends Api
|
|
|
if ($chRes === false) {
|
|
if ($chRes === false) {
|
|
|
$this->error('装版工时记录保存失败');
|
|
$this->error('装版工时记录保存失败');
|
|
|
}
|
|
}
|
|
|
|
|
+ $plateBase = $this->facilityYieldLogBase($params, '新增', 'ChanliangAdd', isset($params['sys_id']) ? $params['sys_id'] : '');
|
|
|
|
|
+ $plateBase['业务表'] = '设备_装版工时';
|
|
|
|
|
+ $plateBase['修改后'] = '换版总工时='.$plateData['换版总工时'].';换版类型='.$plateData['换版类型'].';换版联拼数='.$plateData['换版联拼数'];
|
|
|
|
|
+ $this->saveFacilityOperateLog([$plateBase]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 7. 移除不需要的字段
|
|
// 7. 移除不需要的字段
|
|
@@ -2627,6 +2722,9 @@ class Facility extends Api
|
|
|
$res = db()->query($sql);
|
|
$res = db()->query($sql);
|
|
|
|
|
|
|
|
if ($res !== false) {
|
|
if ($res !== false) {
|
|
|
|
|
+ $yieldLog = $this->facilityYieldLogBase($params, '新增', 'ChanliangAdd', isset($params['sys_id']) ? $params['sys_id'] : '');
|
|
|
|
|
+ $yieldLog['修改后'] = '产量='.(isset($params['sczl_cl']) ? $params['sczl_cl'] : '').';制程废品='.(isset($params['sczl_zcfp']) ? $params['sczl_zcfp'] : '');
|
|
|
|
|
+ $this->saveFacilityOperateLog([$yieldLog]);
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
} else {
|
|
} else {
|
|
|
$this->error('失败');
|
|
$this->error('失败');
|
|
@@ -2649,14 +2747,6 @@ class Facility extends Api
|
|
|
if (empty($param)){
|
|
if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
-// $where = [
|
|
|
|
|
-// 'b.Gy0_sbbh' => ['like','%'.$param['machine'].'%'],
|
|
|
|
|
-// ];
|
|
|
|
|
-// if (!empty($param['machine'])){
|
|
|
|
|
-// $where = [
|
|
|
|
|
-// 'b.Gy0_sbbh' => ['like','%'.$param['machine'].'%'],
|
|
|
|
|
-// ];
|
|
|
|
|
-// }
|
|
|
|
|
if (!empty($param['search'])){
|
|
if (!empty($param['search'])){
|
|
|
$where['b.Gy0_gdbh'] = ['like','%'.$param['search'].'%'];
|
|
$where['b.Gy0_gdbh'] = ['like','%'.$param['search'].'%'];
|
|
|
}
|
|
}
|
|
@@ -2719,28 +2809,15 @@ class Facility extends Api
|
|
|
if (empty($param['gdbh'])){
|
|
if (empty($param['gdbh'])){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
-// $sys_bh = \db('dic_lzde')->where('适用机型',$param['machine'])->value('sys_bh');
|
|
|
|
|
$list = \db('工单_工艺资料')
|
|
$list = \db('工单_工艺资料')
|
|
|
->where('Gy0_gdbh',$param['gdbh'])
|
|
->where('Gy0_gdbh',$param['gdbh'])
|
|
|
->where('Gy0_yjno',$param['yjno'])
|
|
->where('Gy0_yjno',$param['yjno'])
|
|
|
-// ->where('Gy0_sbbh','like','%'.$param['machine'].'%')
|
|
|
|
|
|
|
+
|
|
|
->field('rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc')
|
|
->field('rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc')
|
|
|
->select();
|
|
->select();
|
|
|
if (empty($list)){
|
|
if (empty($list)){
|
|
|
$this->success('未获取工序');
|
|
$this->success('未获取工序');
|
|
|
}
|
|
}
|
|
|
-// $time = \db('设备_产量计酬')
|
|
|
|
|
-// ->where('sczl_gdbh',$param['gdbh'])
|
|
|
|
|
-// ->where('sczl_yjno',$param['yjno'])
|
|
|
|
|
-// ->where('sczl_jtbh','like','%'.$param['machine'].'%')
|
|
|
|
|
-// ->order('UniqId desc')
|
|
|
|
|
-// ->value('sczl_sj2');
|
|
|
|
|
-// $newTime = date('Y-m-d H:i:s');
|
|
|
|
|
-// if ($newTime > date('Y-m-d 08:30:00') && $newTime < date('Y-m-d 20:30:00') && $time < date('Y-m-d 08:30:00')){
|
|
|
|
|
-// $time = date('Y-m-d 08:30:00');
|
|
|
|
|
-// }elseif ($newTime > date('Y-m-d 20:30:00') && $time < date('Y-m-d 20:30:00')){
|
|
|
|
|
-// $time = date('Y-m-d 20:30:00');
|
|
|
|
|
-// }
|
|
|
|
|
foreach ($list as $key=>$value){
|
|
foreach ($list as $key=>$value){
|
|
|
if ((int)$value['gxh'] < 10){
|
|
if ((int)$value['gxh'] < 10){
|
|
|
$value['gxh'] = '0'.$value['gxh'];
|
|
$value['gxh'] = '0'.$value['gxh'];
|
|
@@ -2751,9 +2828,7 @@ class Facility extends Api
|
|
|
$list[$key]['name'] = $value['gxh'].'-'.$value['gxmc'].'【'.$value['add_gxmc'].'】';
|
|
$list[$key]['name'] = $value['gxh'].'-'.$value['gxmc'].'【'.$value['add_gxmc'].'】';
|
|
|
}
|
|
}
|
|
|
unset( $list[$key]['add_gxmc']);
|
|
unset( $list[$key]['add_gxmc']);
|
|
|
-// $list[$key]['time'] = $time;
|
|
|
|
|
}
|
|
}
|
|
|
-// $list['sys_bh'] = $sys_bh;
|
|
|
|
|
$this->success('成功',$list);
|
|
$this->success('成功',$list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2774,6 +2849,13 @@ class Facility extends Api
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
$idList = explode(',',$params['id']);
|
|
$idList = explode(',',$params['id']);
|
|
|
|
|
+ $operator = $this->facilityLogOperator($params);
|
|
|
|
|
+ $oldMap = [];
|
|
|
|
|
+ $oldList = \db('设备_产量计酬')->where('UniqId','in',$idList)->select();
|
|
|
|
|
+ foreach ($oldList as $oldRow) {
|
|
|
|
|
+ $oldMap[trim($oldRow['UniqId'])] = $oldRow;
|
|
|
|
|
+ }
|
|
|
|
|
+ $logs = [];
|
|
|
$i=0;
|
|
$i=0;
|
|
|
foreach ($idList as $key=>$value){
|
|
foreach ($idList as $key=>$value){
|
|
|
$sql = \db('设备_产量计酬')
|
|
$sql = \db('设备_产量计酬')
|
|
@@ -2783,8 +2865,16 @@ class Facility extends Api
|
|
|
$res = \db()->query($sql);
|
|
$res = \db()->query($sql);
|
|
|
if ($res === false){
|
|
if ($res === false){
|
|
|
$i++;
|
|
$i++;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $before = isset($oldMap[trim($value)]) ? $oldMap[trim($value)] : [];
|
|
|
|
|
+ $logs = array_merge($logs, $this->facilityChangedLogs(
|
|
|
|
|
+ $this->facilityYieldLogBase($before, '修改', 'CoefficientEdit', $operator),
|
|
|
|
|
+ $before,
|
|
|
|
|
+ ['sczl_工价系数' => $params['工价系数']]
|
|
|
|
|
+ ));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
if ($i!==0){
|
|
if ($i!==0){
|
|
|
$this->error('修改失败');
|
|
$this->error('修改失败');
|
|
|
}
|
|
}
|
|
@@ -3012,6 +3102,13 @@ class Facility extends Api
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
$idList = explode(',',$params['id']);
|
|
$idList = explode(',',$params['id']);
|
|
|
|
|
+ $operator = $this->facilityLogOperator($params);
|
|
|
|
|
+ $oldMap = [];
|
|
|
|
|
+ $oldList = \db('设备_产量计酬')->where('UniqId','in',$idList)->select();
|
|
|
|
|
+ foreach ($oldList as $oldRow) {
|
|
|
|
|
+ $oldMap[trim($oldRow['UniqId'])] = $oldRow;
|
|
|
|
|
+ }
|
|
|
|
|
+ $logs = [];
|
|
|
$i=0;
|
|
$i=0;
|
|
|
foreach ($idList as $key=>$value){
|
|
foreach ($idList as $key=>$value){
|
|
|
$sql = \db('设备_产量计酬')
|
|
$sql = \db('设备_产量计酬')
|
|
@@ -3021,8 +3118,16 @@ class Facility extends Api
|
|
|
$res = \db()->query($sql);
|
|
$res = \db()->query($sql);
|
|
|
if ($res === false){
|
|
if ($res === false){
|
|
|
$i++;
|
|
$i++;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $before = isset($oldMap[trim($value)]) ? $oldMap[trim($value)] : [];
|
|
|
|
|
+ $logs = array_merge($logs, $this->facilityChangedLogs(
|
|
|
|
|
+ $this->facilityYieldLogBase($before, '修改', 'ChromaDataEdit', $operator),
|
|
|
|
|
+ $before,
|
|
|
|
|
+ ['sczl_ms' => $params['ms']]
|
|
|
|
|
+ ));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
if ($i!==0){
|
|
if ($i!==0){
|
|
|
$this->error('修改失败');
|
|
$this->error('修改失败');
|
|
|
}else{
|
|
}else{
|
|
@@ -3050,21 +3155,39 @@ class Facility extends Api
|
|
|
//获取工单印件工序
|
|
//获取工单印件工序
|
|
|
$orderList = \db('设备_产量计酬')
|
|
$orderList = \db('设备_产量计酬')
|
|
|
->where('UniqId',$idList[0])
|
|
->where('UniqId',$idList[0])
|
|
|
- ->field('rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_yjno) as 印件号,rtrim(sczl_gxh) as 工序号')
|
|
|
|
|
|
|
+ ->field('rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_yjno) as 印件号,rtrim(sczl_gxh) as 工序号,rtrim(sczl_jtbh) as 设备编号,rtrim(sczl_gxmc) as 工序名称')
|
|
|
->find();
|
|
->find();
|
|
|
|
|
+ $where = [
|
|
|
|
|
+ 'Gy0_gdbh'=>$orderList['工单编号'],
|
|
|
|
|
+ 'Gy0_yjno'=>$orderList['印件号'],
|
|
|
|
|
+ 'Gy0_gxh'=>$orderList['工序号']
|
|
|
|
|
+ ];
|
|
|
|
|
+ $before = \db('工单_工艺资料')->where($where)->find();
|
|
|
|
|
+ if (empty($before)) {
|
|
|
|
|
+ $before = [];
|
|
|
|
|
+ }
|
|
|
//修改工艺资料
|
|
//修改工艺资料
|
|
|
|
|
+ $after = ['版距'=>$params['plate'],'印刷方式'=>$params['mode']];
|
|
|
$sql = \db('工单_工艺资料')
|
|
$sql = \db('工单_工艺资料')
|
|
|
- ->where([
|
|
|
|
|
- 'Gy0_gdbh'=>$orderList['工单编号'],
|
|
|
|
|
- 'Gy0_yjno'=>$orderList['印件号'],
|
|
|
|
|
- 'Gy0_gxh'=>$orderList['工序号']
|
|
|
|
|
- ])
|
|
|
|
|
|
|
+ ->where($where)
|
|
|
->fetchSql(true)
|
|
->fetchSql(true)
|
|
|
- ->update(['版距'=>$params['plate'],'印刷方式'=>$params['mode']]);
|
|
|
|
|
|
|
+ ->update($after);
|
|
|
$res = \db()->query($sql);
|
|
$res = \db()->query($sql);
|
|
|
if ($res === false){
|
|
if ($res === false){
|
|
|
$this->error('修改失败');
|
|
$this->error('修改失败');
|
|
|
}else{
|
|
}else{
|
|
|
|
|
+ $this->saveFacilityOperateLog($this->facilityChangedLogs([
|
|
|
|
|
+ '业务表' => '工单_工艺资料',
|
|
|
|
|
+ '操作类型' => '修改',
|
|
|
|
|
+ '方法名' => 'PrintingModeDataEdit',
|
|
|
|
|
+ 'RecordUniqid' => isset($before['UniqId']) ? $before['UniqId'] : '',
|
|
|
|
|
+ '设备编号' => $orderList['设备编号'],
|
|
|
|
|
+ '工单编号' => $orderList['工单编号'],
|
|
|
|
|
+ '印件号' => $orderList['印件号'],
|
|
|
|
|
+ '工序号' => $orderList['工序号'],
|
|
|
|
|
+ '工序名称' => $orderList['工序名称'],
|
|
|
|
|
+ 'sys_id' => $this->facilityLogOperator($params),
|
|
|
|
|
+ ], $before, $after));
|
|
|
$this->success('修改成功');
|
|
$this->success('修改成功');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -3086,6 +3209,13 @@ class Facility extends Api
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
$idList = explode(',',$params['id']);
|
|
$idList = explode(',',$params['id']);
|
|
|
|
|
+ $operator = $this->facilityLogOperator($params);
|
|
|
|
|
+ $oldMap = [];
|
|
|
|
|
+ $oldList = \db('设备_产量计酬')->where('UniqId','in',$idList)->select();
|
|
|
|
|
+ foreach ($oldList as $oldRow) {
|
|
|
|
|
+ $oldMap[trim($oldRow['UniqId'])] = $oldRow;
|
|
|
|
|
+ }
|
|
|
|
|
+ $logs = [];
|
|
|
$i=0;
|
|
$i=0;
|
|
|
foreach ($idList as $key=>$value){
|
|
foreach ($idList as $key=>$value){
|
|
|
$sql = \db('设备_产量计酬')
|
|
$sql = \db('设备_产量计酬')
|
|
@@ -3095,8 +3225,16 @@ class Facility extends Api
|
|
|
$res = \db()->query($sql);
|
|
$res = \db()->query($sql);
|
|
|
if ($res === false){
|
|
if ($res === false){
|
|
|
$i++;
|
|
$i++;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $before = isset($oldMap[trim($value)]) ? $oldMap[trim($value)] : [];
|
|
|
|
|
+ $logs = array_merge($logs, $this->facilityChangedLogs(
|
|
|
|
|
+ $this->facilityYieldLogBase($before, '修改', 'RejectionEdit', $operator),
|
|
|
|
|
+ $before,
|
|
|
|
|
+ ['sczl_废品率系数' => $params['rejection']]
|
|
|
|
|
+ ));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
if ($i!==0){
|
|
if ($i!==0){
|
|
|
$this->error('修改失败');
|
|
$this->error('修改失败');
|
|
|
}else{
|
|
}else{
|
|
@@ -3124,6 +3262,7 @@ class Facility extends Api
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
$idList = explode(',',$param['Uniqid']);
|
|
$idList = explode(',',$param['Uniqid']);
|
|
|
|
|
+ $operator = $this->facilityLogOperator($param);
|
|
|
$teamList = \db('设备_班组资料')->where('UniqId',$param['teamID'])->find();
|
|
$teamList = \db('设备_班组资料')->where('UniqId',$param['teamID'])->find();
|
|
|
$data = [];
|
|
$data = [];
|
|
|
for ($i=1;$i<11;$i++){
|
|
for ($i=1;$i<11;$i++){
|
|
@@ -3131,6 +3270,12 @@ class Facility extends Api
|
|
|
$data['sczl_rate'.$i] = $teamList['sczl_rate'.$i];
|
|
$data['sczl_rate'.$i] = $teamList['sczl_rate'.$i];
|
|
|
$data['sczl_bzdh'] = $teamList['sczl_bzdh'];
|
|
$data['sczl_bzdh'] = $teamList['sczl_bzdh'];
|
|
|
}
|
|
}
|
|
|
|
|
+ $oldMap = [];
|
|
|
|
|
+ $oldList = \db('设备_产量计酬')->where('UniqId','in',$idList)->select();
|
|
|
|
|
+ foreach ($oldList as $oldRow) {
|
|
|
|
|
+ $oldMap[trim($oldRow['UniqId'])] = $oldRow;
|
|
|
|
|
+ }
|
|
|
|
|
+ $logs = [];
|
|
|
$j = 0;
|
|
$j = 0;
|
|
|
foreach ($idList as $key => $value){
|
|
foreach ($idList as $key => $value){
|
|
|
$sql = \db('设备_产量计酬')
|
|
$sql = \db('设备_产量计酬')
|
|
@@ -3140,8 +3285,16 @@ class Facility extends Api
|
|
|
$res = \db()->query($sql);
|
|
$res = \db()->query($sql);
|
|
|
if ($res === false){
|
|
if ($res === false){
|
|
|
$j++;
|
|
$j++;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $before = isset($oldMap[trim($value)]) ? $oldMap[trim($value)] : [];
|
|
|
|
|
+ $logs = array_merge($logs, $this->facilityChangedLogs(
|
|
|
|
|
+ $this->facilityYieldLogBase($before, '修改', 'YieldTeamEdit', $operator),
|
|
|
|
|
+ $before,
|
|
|
|
|
+ $data
|
|
|
|
|
+ ));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $this->saveFacilityOperateLog($logs);
|
|
|
if ($j === 0){
|
|
if ($j === 0){
|
|
|
$this->success('修改成功');
|
|
$this->success('修改成功');
|
|
|
}else{
|
|
}else{
|
|
@@ -3165,6 +3318,11 @@ class Facility extends Api
|
|
|
if (empty($params['UniqId'])){
|
|
if (empty($params['UniqId'])){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
|
|
+ $before = \db('设备_产量计酬')->where('UniqId',$params['UniqId'])->find();
|
|
|
|
|
+ if (empty($before)) {
|
|
|
|
|
+ $before = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ $operator = $this->facilityLogOperator($params);
|
|
|
$params['mod_rq'] = date('Y-m-d H:i:s');
|
|
$params['mod_rq'] = date('Y-m-d H:i:s');
|
|
|
$data = $params;
|
|
$data = $params;
|
|
|
unset($data['UniqId']);
|
|
unset($data['UniqId']);
|
|
@@ -3173,6 +3331,11 @@ class Facility extends Api
|
|
|
if ($res === false){
|
|
if ($res === false){
|
|
|
$this->error('修改失败');
|
|
$this->error('修改失败');
|
|
|
}else{
|
|
}else{
|
|
|
|
|
+ $this->saveFacilityOperateLog($this->facilityChangedLogs(
|
|
|
|
|
+ $this->facilityYieldLogBase($before, '修改', 'JpChanliangEdit', $operator),
|
|
|
|
|
+ $before,
|
|
|
|
|
+ $data
|
|
|
|
|
+ ));
|
|
|
$this->success('成功');
|
|
$this->success('成功');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -3530,4 +3693,161 @@ class Facility extends Api
|
|
|
}
|
|
}
|
|
|
$this->success('成功',$result);
|
|
$this->success('成功',$result);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 写入设备报工操作日志。日志失败不影响报工结果。
|
|
|
|
|
+ * @param array $rows
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function saveFacilityOperateLog(array $rows)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (empty($rows)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ $now = date('Y-m-d H:i:s');
|
|
|
|
|
+ $logs = [];
|
|
|
|
|
+ foreach ($rows as $row) {
|
|
|
|
|
+ $logs[] = [
|
|
|
|
|
+ '业务表' => $this->facilityLogCut(isset($row['业务表']) ? $row['业务表'] : '', 50),
|
|
|
|
|
+ '操作类型' => $this->facilityLogCut(isset($row['操作类型']) ? $row['操作类型'] : '', 20),
|
|
|
|
|
+ '方法名' => $this->facilityLogCut(isset($row['方法名']) ? $row['方法名'] : '', 50),
|
|
|
|
|
+ 'RecordUniqid' => $this->facilityLogCut(isset($row['RecordUniqid']) ? $row['RecordUniqid'] : '', 50),
|
|
|
|
|
+ '设备编号' => $this->facilityLogCut(isset($row['设备编号']) ? $row['设备编号'] : '', 50),
|
|
|
|
|
+ '班组编号' => $this->facilityLogCut(isset($row['班组编号']) ? $row['班组编号'] : '', 50),
|
|
|
|
|
+ '工单编号' => $this->facilityLogCut(isset($row['工单编号']) ? $row['工单编号'] : '', 50),
|
|
|
|
|
+ '印件号' => $this->facilityLogCut(isset($row['印件号']) ? $row['印件号'] : '', 20),
|
|
|
|
|
+ '工序号' => $this->facilityLogCut(isset($row['工序号']) ? $row['工序号'] : '', 20),
|
|
|
|
|
+ '工序名称' => $this->facilityLogCut(isset($row['工序名称']) ? $row['工序名称'] : '', 100),
|
|
|
|
|
+ '字段名' => $this->facilityLogCut(isset($row['字段名']) ? $row['字段名'] : '', 50),
|
|
|
|
|
+ '修改前' => isset($row['修改前']) ? (string)$row['修改前'] : '',
|
|
|
|
|
+ '修改后' => isset($row['修改后']) ? (string)$row['修改后'] : '',
|
|
|
|
|
+ 'sys_id' => $this->facilityLogCut(isset($row['sys_id']) ? $row['sys_id'] : '', 50),
|
|
|
|
|
+ 'sys_rq' => $now,
|
|
|
|
|
+ '备注' => $this->facilityLogCut(isset($row['备注']) ? $row['备注'] : '', 500),
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ \db('设备报工操作日志')->insertAll($logs);
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
|
+ Log::write('记录设备报工操作日志失败: ' . $e->getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 从请求中取操作人。业务表没有该字段时只用于日志。
|
|
|
|
|
+ * @param array|null $source
|
|
|
|
|
+ * @return string
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function facilityLogOperator($source = null)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (is_array($source)) {
|
|
|
|
|
+ foreach (['sys_id', 'Sys_id'] as $key) {
|
|
|
|
|
+ if (isset($source[$key]) && $source[$key] !== '' && $source[$key] !== null) {
|
|
|
|
|
+ return trim((string)$source[$key]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $operator = input('sys_id');
|
|
|
|
|
+ if ($operator === null || $operator === '') {
|
|
|
|
|
+ $operator = input('Sys_id');
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($operator === null || $operator === '' || is_array($operator)) {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ return trim((string)$operator);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param mixed $value
|
|
|
|
|
+ * @param int $length
|
|
|
|
|
+ * @return string
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function facilityLogCut($value, $length)
|
|
|
|
|
+ {
|
|
|
|
|
+ $value = trim((string)$value);
|
|
|
|
|
+ if ($value === '') {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ if (function_exists('mb_substr')) {
|
|
|
|
|
+ return mb_substr($value, 0, $length, 'UTF-8');
|
|
|
|
|
+ }
|
|
|
|
|
+ return substr($value, 0, $length);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按字段对比,只保留有变化的项
|
|
|
|
|
+ * @param array $base
|
|
|
|
|
+ * @param array $before
|
|
|
|
|
+ * @param array $after
|
|
|
|
|
+ * @param array $skip
|
|
|
|
|
+ * @return array
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function facilityChangedLogs(array $base, array $before, array $after, array $skip = [])
|
|
|
|
|
+ {
|
|
|
|
|
+ $skip = array_merge(['mod_rq', 'Mod_rq', 'sys_rq', 'Sys_rq', 'UniqId', 'UniqID', 'Uniqid', 'sys_id', 'Sys_id'], $skip);
|
|
|
|
|
+ $logs = [];
|
|
|
|
|
+ foreach ($after as $field => $newValue) {
|
|
|
|
|
+ if (in_array($field, $skip, true) || is_array($newValue)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ $oldText = array_key_exists($field, $before) ? trim((string)$before[$field]) : '';
|
|
|
|
|
+ $newText = trim((string)$newValue);
|
|
|
|
|
+ if ($oldText === $newText) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ $item = $base;
|
|
|
|
|
+ $item['字段名'] = $field;
|
|
|
|
|
+ $item['修改前'] = $oldText;
|
|
|
|
|
+ $item['修改后'] = $newText;
|
|
|
|
|
+ $logs[] = $item;
|
|
|
|
|
+ }
|
|
|
|
|
+ return $logs;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param array $row
|
|
|
|
|
+ * @return string
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function facilityTeamMemberText(array $row)
|
|
|
|
|
+ {
|
|
|
|
|
+ $members = [];
|
|
|
|
|
+ for ($i = 1; $i < 11; $i++) {
|
|
|
|
|
+ $code = isset($row['sczl_bh'.$i]) ? trim((string)$row['sczl_bh'.$i]) : '';
|
|
|
|
|
+ if ($code !== '' && $code !== '0') {
|
|
|
|
|
+ $members[] = $code;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $teamCode = isset($row['sczl_bzdh']) ? trim((string)$row['sczl_bzdh']) : '';
|
|
|
|
|
+ return '班组编号='.$teamCode.';成员='.implode(',', $members);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param array $row
|
|
|
|
|
+ * @param string $action
|
|
|
|
|
+ * @param string $method
|
|
|
|
|
+ * @param string $operator
|
|
|
|
|
+ * @return array
|
|
|
|
|
+ */
|
|
|
|
|
+ protected function facilityYieldLogBase(array $row, $action, $method, $operator)
|
|
|
|
|
+ {
|
|
|
|
|
+ $uniqid = '';
|
|
|
|
|
+ if (isset($row['UniqId'])) {
|
|
|
|
|
+ $uniqid = $row['UniqId'];
|
|
|
|
|
+ } elseif (isset($row['UniqID'])) {
|
|
|
|
|
+ $uniqid = $row['UniqID'];
|
|
|
|
|
+ }
|
|
|
|
|
+ return [
|
|
|
|
|
+ '业务表' => '设备_产量计酬',
|
|
|
|
|
+ '操作类型' => $action,
|
|
|
|
|
+ '方法名' => $method,
|
|
|
|
|
+ 'RecordUniqid' => trim((string)$uniqid),
|
|
|
|
|
+ '设备编号' => isset($row['sczl_jtbh']) ? trim((string)$row['sczl_jtbh']) : '',
|
|
|
|
|
+ '班组编号' => isset($row['sczl_bzdh']) ? trim((string)$row['sczl_bzdh']) : '',
|
|
|
|
|
+ '工单编号' => isset($row['sczl_gdbh']) ? trim((string)$row['sczl_gdbh']) : '',
|
|
|
|
|
+ '印件号' => isset($row['sczl_yjno']) ? trim((string)$row['sczl_yjno']) : '',
|
|
|
|
|
+ '工序号' => isset($row['sczl_gxh']) ? trim((string)$row['sczl_gxh']) : '',
|
|
|
|
|
+ '工序名称' => isset($row['sczl_gxmc']) ? trim((string)$row['sczl_gxmc']) : '',
|
|
|
|
|
+ 'sys_id' => $operator,
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|