import request from '@/utils/request'
import state from '@/store'
import router from '@/router'
// 查询加工工时统计表
export function getwork_state() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'MES_机加工MES_设备数据采集_工作状态_查询'
    }
  })
}
// 查询工位状态
export function getOP_state() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'MES_机加工MES_设备数据采集_工位状态_查询'
    }
  })
}
// 查询零件图号
export function searchtooltip(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'MES_机加工MES_工位零件图号查询_设备监控',
      param: '工位号=' + num
    }
  })
}
// 查询工位状态
export function getOP_state2(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'MES_机加工MES_设备数据采集_工位状态_查询_按工位号',
      param: '工位号=' + num
    }
  })
}
// 查询待加工零件
export function getDaijiagong(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'MES_机加工MES_待加工零件_查询_设备监控',
      param: '工位号=' + num
    }
  })
}
// 查询总装
export function getZongzhuang() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '3',
      name: 'SELECT 机床图号 FROM PDM_机床名称 where 机床装配实际开始时间 is not null and 机床装配实际完成时间 is null'
    }
  })
}
// 查询部装
export function getBuzhuang() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '3',
      name: '\n' +
        'SELECT     dbo.PDM_机床名称.机床图号, dbo.车间管理_工作计划.组号, dbo.车间管理_工作计划.任务名称, dbo.PDM_项目名称.是否启用\n' +
        'FROM         dbo.车间管理_工作计划 INNER JOIN\n' +
        '                      dbo.PDM_机床名称 ON dbo.车间管理_工作计划.机床流水号 = dbo.PDM_机床名称.机床流水号 INNER JOIN\n' +
        '                      dbo.PDM_项目名称 ON dbo.PDM_机床名称.项目流水号 = dbo.PDM_项目名称.项目流水号\n' +
        'WHERE     (dbo.车间管理_工作计划.计划类型 = 1) AND (dbo.车间管理_工作计划.是否工作 = 1) AND (dbo.PDM_项目名称.是否启用 = 1) and 分配时间 is not null'
    }
  })
}
