|
|
@@ -237,7 +237,7 @@ class GluingReport extends Api
|
|
|
if ($res === false){
|
|
|
$this->error('新增失败');
|
|
|
}else{
|
|
|
- $this->success('新增失败');
|
|
|
+ $this->success('新增成功');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -264,9 +264,9 @@ class GluingReport extends Api
|
|
|
->where('id',$id)
|
|
|
->update($param);
|
|
|
if ($res === false){
|
|
|
- $this->error('修改成功');
|
|
|
+ $this->error('修改失败');
|
|
|
}else{
|
|
|
- $this->success('修改失败');
|
|
|
+ $this->success('修改成功');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -348,25 +348,13 @@ class GluingReport extends Api
|
|
|
}
|
|
|
|
|
|
|
|
|
-// public function gitGluingReportList()
|
|
|
-// {
|
|
|
-// if ($this->request->isGet() === false){
|
|
|
-// $this->error('请求错误');
|
|
|
-// }
|
|
|
-// $param = $this->request->param();
|
|
|
-// if (empty($param)){
|
|
|
-// $this->error('参数错误');
|
|
|
-// }
|
|
|
-// $where = [
|
|
|
-// 'a.sczl_jtbh' => $param['machine'],
|
|
|
-// 'a.sys_rq' => $param['date'],
|
|
|
-// ];
|
|
|
-// $list = \db('设备_糊盒报工资料')
|
|
|
-// ->alias('a')
|
|
|
-// ->join('工单_基本资料 b','a.sczl_gdbh = b.Gd_gdbh')
|
|
|
-// ->join('设备_糊盒班组资料 c','a. = c.Gd_gdbh')
|
|
|
-// }
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 获取当前生产工单
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @throws \think\exception\DbException
|
|
|
+ */
|
|
|
public function GetProduction()
|
|
|
{
|
|
|
if (Request::instance()->isGet() == false) {
|
|
|
@@ -378,7 +366,7 @@ class GluingReport extends Api
|
|
|
}
|
|
|
$machine = $params['machine'];
|
|
|
$machineCode = \db('dic_lzde')->where('适用机型',$machine)->value('sys_bh');
|
|
|
- $data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
|
|
|
+ $data = \db('设备_糊盒报工采集')->where('sczl_jtbh',$machine)->order('UID desc')->find();
|
|
|
$list = [];
|
|
|
$row = [];
|
|
|
if (!empty($data['工单编号'])){
|
|
|
@@ -407,28 +395,39 @@ class GluingReport extends Api
|
|
|
$list['状态'] = '';
|
|
|
$list['开工时间'] = '';
|
|
|
}
|
|
|
- $list['班组编号'] = rtrim($data['班组编号']);
|
|
|
- $list['班组Id'] = rtrim($data['班组ID']);
|
|
|
- $class = \db('设备_班组资料')->where('UniqId',$data['班组ID'])->field("rtrim(sczl_bh1) as bh1,rtrim(sczl_bh2) as bh2,rtrim(sczl_bh3) as bh3,rtrim(sczl_bh4) as bh4,
|
|
|
- rtrim(sczl_bh5) as bh5,rtrim(sczl_bh6) as bh6,rtrim(sczl_bh7) as bh7,rtrim(sczl_bh8) as bh8,rtrim(sczl_bh9) as bh9,
|
|
|
- rtrim(sczl_bh10) as bh10")->find();
|
|
|
- if (!empty($class)){
|
|
|
- for ($i=1;$i<11;$i++) {
|
|
|
- if ($class['bh' . $i] != '' && $class['bh' . $i] != '000000') {
|
|
|
- $name = \db('人事_基本资料')->where('员工编号', $class['bh' . $i])->field('rtrim(员工姓名) as 姓名')->find();
|
|
|
- $row[$i] = [
|
|
|
- '编号' => $class['bh' . $i],
|
|
|
- '姓名' => $name['姓名']
|
|
|
- ];
|
|
|
+ $list['班组编号'] = rtrim($data['sczl_bzbh']);
|
|
|
+ $idList = explode(',',$data['班组ID']);
|
|
|
+ foreach ($idList as $k=>$v){
|
|
|
+ $class = \db('设备_糊盒班组资料')
|
|
|
+ ->where('id',$v)
|
|
|
+ ->field("role,rate,bh1,bh2,bh3,bh4,bh5,bh6,bh7,bh8,bh9,bh10,bh11,bh12,bh13,bh14,bh15")
|
|
|
+ ->find();
|
|
|
+ if (!empty($class)){
|
|
|
+ for ($i=1;$i<16;$i++) {
|
|
|
+ if ($class['bh' . $i] != '' && $class['bh' . $i] != '000000') {
|
|
|
+ $name = \db('人事_基本资料')->where('员工编号', $class['bh' . $i])->field('rtrim(员工姓名) as 姓名')->find();
|
|
|
+ $row[$i] = [
|
|
|
+ '编号' => $class['bh' . $i],
|
|
|
+ '姓名' => $name['姓名'],
|
|
|
+ '比例' => $class['rate'],
|
|
|
+ '角色' => $class['role'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|
|
|
+ $row = array_values($row);
|
|
|
}
|
|
|
- $row = array_values($row);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
$list['班组成员'] = $row;
|
|
|
$list['定额代号'] = $machineCode;
|
|
|
$this->success('成功',$list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置当前工单和当前班组
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
public function setMachineTeam()
|
|
|
{
|
|
|
if (Request::instance()->isPost() == false) {
|
|
|
@@ -443,20 +442,14 @@ class GluingReport extends Api
|
|
|
}
|
|
|
$machine = $params['machine'] . '#';
|
|
|
$data = [];
|
|
|
- $lastData = \db('设备_产量采集')
|
|
|
- ->order('UniqId desc')
|
|
|
- ->find();
|
|
|
- $id = $lastData['UniqId']+1;
|
|
|
- $data['当前状态'] = $params['status'];
|
|
|
- $data['时间'] = date('Y-m-d H:i:s');
|
|
|
- $data['设备编号'] = $machine;
|
|
|
- $data['工单编号'] = empty($params['order']) ? '':$params['order'];
|
|
|
- $data['印件号'] = empty($params['yjno']) ? '':$params['yjno'];
|
|
|
- $data['工序号'] = empty($params['gy_name']) ? '' : (int)substr($params['gy_name'], 0, 2);
|
|
|
- $data['工序名称'] = empty($params['gy_name']) ? '' : $params['gy_name'];
|
|
|
- $data['当班产量'] = $params['production_now'];
|
|
|
- $data['累计产量'] = $params['production_all'];
|
|
|
- $data['班组编号'] = $params['sczl_bzdh'];
|
|
|
+ $data['status'] = $params['status'];
|
|
|
+ $data['sczl_sj'] = date('Y-m-d H:i:s');
|
|
|
+ $data['sczl_jtbh'] = $machine;
|
|
|
+ $data['sczl_gdbh'] = empty($params['order']) ? '':$params['order'];
|
|
|
+ $data['sczl_yjno'] = empty($params['yjno']) ? '':$params['yjno'];
|
|
|
+ $data['sczl_gxh'] = empty($params['gy_name']) ? '' : (int)substr($params['gy_name'], 0, 2);
|
|
|
+ $data['sczl_gxmc'] = empty($params['gy_name']) ? '' : $params['gy_name'];
|
|
|
+ $data['sczl_bzbh'] = $params['sczl_bzdh'];
|
|
|
$data['班组ID'] = $params['team_id'];
|
|
|
// 获取当前时间
|
|
|
$current_time = time();
|
|
|
@@ -468,14 +461,14 @@ class GluingReport extends Api
|
|
|
$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';
|
|
|
+ $data['sczl_kgsj'] = date('Y-m-d') . ' 08:30:00';
|
|
|
} elseif ($current_time > $end_time1 && $current_time <= $end_time2) {
|
|
|
- $data['开工时间'] = date('Y-m-d') . ' 20:30:00';
|
|
|
+ $data['sczl_kgsj'] = 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';
|
|
|
+ $data['sczl_kgsj'] = 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';
|
|
|
+ $data['sczl_kgsj'] = date('Y-m-d') . ' 20:30:00';
|
|
|
}
|
|
|
if (!empty($params['order']) && !empty($params['yjno'])){
|
|
|
$option['Gy0_gdbh'] = $params['order'];
|
|
|
@@ -485,8 +478,7 @@ class GluingReport extends Api
|
|
|
}else{
|
|
|
$data['任务ID'] = '';
|
|
|
}
|
|
|
- $data['UniqId'] = $id;
|
|
|
- $sql = \db('设备_产量采集')->fetchSql(true)->insert($data);
|
|
|
+ $sql = \db('设备_糊盒报工采集')->fetchSql(true)->insert($data);
|
|
|
$res = Db::query($sql);
|
|
|
if ($res === false) {
|
|
|
$this->error('设置失败');
|