|
|
@@ -238,49 +238,77 @@ class Facility extends Api
|
|
|
*/
|
|
|
public function Production()
|
|
|
{
|
|
|
- if ($this->request->isGet() === false){
|
|
|
- $this->error('请求错误');
|
|
|
+ if (Request::instance()->isGet() == false) {
|
|
|
+ $this->error('非法请求');
|
|
|
}
|
|
|
- $machine = input('machine');
|
|
|
- if (empty($machine)){
|
|
|
+ $params = Request::instance()->param();
|
|
|
+ if (!isset($params['machine']) || empty($params['machine'])) {
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
- $sql = "SELECT
|
|
|
- rtrim(b.Gy0_gdbh) AS 工单编号,
|
|
|
- rtrim(b.Gy0_yjno) AS 印件号,
|
|
|
- rtrim(b.Gy0_gxh) AS gxh,
|
|
|
- rtrim(b.Gy0_gxmc) AS gxmc,
|
|
|
- rtrim(b.Add_gxmc) AS add_gxmc,
|
|
|
- RTRIM(a.Gd_cpmc) AS 产品名称
|
|
|
- FROM
|
|
|
- `工单_基本资料` AS a
|
|
|
- JOIN `工单_工艺资料` AS b ON a.Gd_gdbh = b.Gy0_gdbh
|
|
|
- JOIN `产品_基本资料` AS c ON a.`成品代号` = c.`产品编号`
|
|
|
- JOIN `工单_印件资料` AS d ON a.Gd_gdbh = d.Yj_Gdbh
|
|
|
- LEFT JOIN `设备_产量计酬` AS e ON e.sczl_gdbh = a.Gd_gdbh
|
|
|
- AND e.sczl_jtbh = b.Gy0_sbbh
|
|
|
- WHERE
|
|
|
- a.gd_statu = '2-生产中'
|
|
|
- AND a.`行号` = '1'
|
|
|
- AND b.Gy0_sbbh = '{$machine}'
|
|
|
- AND c.`状态` = ''
|
|
|
- AND b.PD_WG = '1900-01-01 00:00:00'
|
|
|
- AND b.Gy0_sj1 <> '1900-01-01 00:00:00'
|
|
|
- GROUP BY
|
|
|
- a.Gd_gdbh
|
|
|
- LIMIT 1";
|
|
|
- $list = Db::query($sql);
|
|
|
- if (empty($list)){
|
|
|
- $this->success('未找到排产工单',[]);
|
|
|
- }
|
|
|
- foreach ($list as $key=>$value){
|
|
|
- if ($value['gxh']<10){
|
|
|
- $list[$key]['gxh'] = '0'.$value['gxh'];
|
|
|
+ $machine = $params['machine'];
|
|
|
+ $data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
|
|
|
+ $list = [];
|
|
|
+ $list['工单编号'] = $data['工单编号'];
|
|
|
+ $list['印件号'] = $data['印件号'];
|
|
|
+ $name = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品名称');
|
|
|
+ $list['产品名称'] = rtrim($name);
|
|
|
+ $where['Gy0_gdbh'] = $data['工单编号'];
|
|
|
+ $where['Gy0_yjno'] = $data['印件号'];
|
|
|
+ $where['Gy0_gxh'] = $data['工序号'];
|
|
|
+ $gxmc = \db('工单_工艺资料')->where($where)->value('Gy0_gxmc');
|
|
|
+ $list['工序名称'] = rtrim($gxmc);
|
|
|
+ $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();
|
|
|
+ $row = [];
|
|
|
+ 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[$key]['工序名称'] = $list[$key]['gxh'].'-'.$value['gxmc'].'【'.$value['add_gxmc'].'】';
|
|
|
- unset($list[$key]['gxh'],$list[$key]['gxmc'],$list[$key]['add_gxmc']);
|
|
|
}
|
|
|
+ $list['班组成员'] = $row;
|
|
|
$this->success('成功',$list);
|
|
|
+// $this->success('请求成功',$list);
|
|
|
+// $sql = "SELECT
|
|
|
+// rtrim(b.Gy0_gdbh) AS 工单编号,
|
|
|
+// rtrim(b.Gy0_yjno) AS 印件号,
|
|
|
+// rtrim(b.Gy0_gxh) AS gxh,
|
|
|
+// rtrim(b.Gy0_gxmc) AS gxmc,
|
|
|
+// rtrim(b.Add_gxmc) AS add_gxmc,
|
|
|
+// RTRIM(a.Gd_cpmc) AS 产品名称
|
|
|
+// FROM
|
|
|
+// `工单_基本资料` AS a
|
|
|
+// JOIN `工单_工艺资料` AS b ON a.Gd_gdbh = b.Gy0_gdbh
|
|
|
+// JOIN `产品_基本资料` AS c ON a.`成品代号` = c.`产品编号`
|
|
|
+// JOIN `工单_印件资料` AS d ON a.Gd_gdbh = d.Yj_Gdbh
|
|
|
+// LEFT JOIN `设备_产量计酬` AS e ON e.sczl_gdbh = a.Gd_gdbh
|
|
|
+// AND e.sczl_jtbh = b.Gy0_sbbh
|
|
|
+// WHERE
|
|
|
+// a.gd_statu = '2-生产中'
|
|
|
+// AND a.`行号` = '1'
|
|
|
+// AND b.Gy0_sbbh = '{$machine}'
|
|
|
+// AND c.`状态` = ''
|
|
|
+// AND b.PD_WG = '1900-01-01 00:00:00'
|
|
|
+// AND b.Gy0_sj1 <> '1900-01-01 00:00:00'
|
|
|
+// GROUP BY
|
|
|
+// a.Gd_gdbh
|
|
|
+// LIMIT 1";
|
|
|
+// $list = Db::query($sql);
|
|
|
+// if (empty($list)){
|
|
|
+// $this->success('未找到排产工单',[]);
|
|
|
+// }
|
|
|
+// foreach ($list as $key=>$value){
|
|
|
+// if ($value['gxh']<10){
|
|
|
+// $list[$key]['gxh'] = '0'.$value['gxh'];
|
|
|
+// }
|
|
|
+// $list[$key]['工序名称'] = $list[$key]['gxh'].'-'.$value['gxmc'].'【'.$value['add_gxmc'].'】';
|
|
|
+// unset($list[$key]['gxh'],$list[$key]['gxmc'],$list[$key]['add_gxmc']);
|
|
|
+// }
|
|
|
+// $this->success('成功',$list);
|
|
|
}
|
|
|
|
|
|
/**
|