|
|
@@ -3,7 +3,8 @@
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\common\controller\Api;
|
|
|
-
|
|
|
+use \think\Request;
|
|
|
+use \think\Db;
|
|
|
/**
|
|
|
* 工单核验单维护接口
|
|
|
*/
|
|
|
@@ -84,12 +85,12 @@ class WorkOrderVerification extends Api
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
if (isset($req['sys_id']) && !empty($req['sys_id'])) $where['sys_id'] = ['LIKE','%'.$req['sys_id'].'%'];
|
|
|
-
|
|
|
+ if (isset($req['order']) && !empty($req['order'])) $where['qczl_gdbh'] = $req['order'];
|
|
|
$rows = db()->table('db_qczl')
|
|
|
->field('qczl_gdbh, qczl_yjno, LEFT(qczl_rq, 10) as qczl_rq, qczl_num, rtrim(qczl_NumDesc) as qczl_NumDesc, qczl_fp,
|
|
|
fp_lb1, fp_lb2, fp_lb3, fp_lb4, fp_lb5, fp_lb6, fp_lb7, fp_lb8, fp_lb9, fp_lb10, fp_lb11, fp_lb12, fp_lb13, fp_lb14, fp_lb15, fp_lb16, fp_lb17,
|
|
|
fp_sl1, fp_sl2, fp_sl3, fp_sl4, fp_sl5, fp_sl6, fp_sl7, fp_sl8, fp_sl9, fp_sl10, fp_sl11, fp_sl12, fp_sl13, fp_sl14, fp_sl15, fp_sl16, fp_sl17,
|
|
|
- rtrim(sys_id) as sys_id')
|
|
|
+ rtrim(sys_id) as sys_id,UniqId')
|
|
|
->where($where)
|
|
|
->order('UniqId desc')
|
|
|
->page($page,$limit)
|
|
|
@@ -146,4 +147,208 @@ class WorkOrderVerification extends Api
|
|
|
|
|
|
$this->success('成功',$rows);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 获取单个工单核检单信息
|
|
|
+ * @ApiMethod GET
|
|
|
+ * @params string UniqId
|
|
|
+ */
|
|
|
+ public function getOneWorkOrder(){
|
|
|
+ if (Request::instance()->isGet() == false){
|
|
|
+ $this->error('非法请求');
|
|
|
+ }
|
|
|
+ $params = Request::instance()->param();
|
|
|
+ if (!isset($params['UniqId']) || empty($params['UniqId'])){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $list = Db::name('db_qczl')->where('UniqId',$params['UniqId'])->find();
|
|
|
+ $list['fp_name1'] = '';
|
|
|
+ if (!empty($list['fp_bh1'])){
|
|
|
+ $list['fp_name1'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh1'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name2'] = '';
|
|
|
+ if (!empty($list['fp_bh2'])){
|
|
|
+ $list['fp_name2'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh2'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name3'] = '';
|
|
|
+ if (!empty($list['fp_bh3'])){
|
|
|
+ $list['fp_name3'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh3'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name4'] = '';
|
|
|
+ if (!empty($list['fp_bh4'])){
|
|
|
+ $list['fp_name4'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh4'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name5'] = '';
|
|
|
+ if (!empty($list['fp_bh5'])){
|
|
|
+ $list['fp_name5'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh5'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name6'] = '';
|
|
|
+ if (!empty($list['fp_bh6'])){
|
|
|
+ $list['fp_name6'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh6'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name7'] = '';
|
|
|
+ if (!empty($list['fp_bh7'])){
|
|
|
+ $list['fp_name7'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh7'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name8'] = '';
|
|
|
+ if (!empty($list['fp_bh8'])){
|
|
|
+ $list['fp_name8'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh8'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name9'] = '';
|
|
|
+ if (!empty($list['fp_bh9'])){
|
|
|
+ $list['fp_name9'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh9'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name10'] = '';
|
|
|
+ if (!empty($list['fp_bh10'])){
|
|
|
+ $list['fp_name10'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh10'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name11'] = '';
|
|
|
+ if (!empty($list['fp_bh11'])){
|
|
|
+ $list['fp_name11'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh11'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name12'] = '';
|
|
|
+ if (!empty($list['fp_bh12'])){
|
|
|
+ $list['fp_name12'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh12'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $list['fp_name13'] = '';
|
|
|
+ if (!empty($list['fp_bh13'])){
|
|
|
+ $list['fp_name13'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh13'])->value('rtrim(员工姓名)');
|
|
|
+ }
|
|
|
+ $max = Db::name('设备_产量计酬')->where('sczl_gdbh',$list['qczl_gdbh'])->field('MAX(sczl_num) as sczl_num')->find();
|
|
|
+ $list['total_liucheng'] = $max['sczl_num'];
|
|
|
+ $this->success('请求成功',$list);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取工单基本信息
|
|
|
+ * @ApiMethod GET
|
|
|
+ * @params string order
|
|
|
+ */
|
|
|
+ public function getOrderInfo(){
|
|
|
+ if (Request::instance()->isGet() == false){
|
|
|
+ $this->error('非法请求');
|
|
|
+ }
|
|
|
+ $params = Request::instance()->param();
|
|
|
+ if (!isset($params['order']) || empty($params['order'])){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $list = Db::name('工单_基本资料')->alias('a')
|
|
|
+ ->join('工单_印件资料 b','a.Gd_gdbh = b.Yj_Gdbh','left')
|
|
|
+ ->where('a.Gd_gdbh',$params['order'])
|
|
|
+ ->where('a.行号',1)
|
|
|
+ ->field('a.Gd_cpmc,b.yj_Yjno,b.yj_yjmc')
|
|
|
+ ->find();
|
|
|
+ $this->success('请求成功',$list);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取印件名称及工序
|
|
|
+ * @ApiMethod GET
|
|
|
+ * @params string order
|
|
|
+ * @params string yj_no
|
|
|
+ */
|
|
|
+ public function getYjInfo(){
|
|
|
+ if (Request::instance()->isGet() == false){
|
|
|
+ $this->error('非法请求');
|
|
|
+ }
|
|
|
+ $params = Request::instance()->param();
|
|
|
+ if (!isset($params['order']) || empty($params['order'])){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ if (!isset($params['yj_no']) || empty($params['yj_no'])){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $where['Yj_Gdbh'] = $params['order'];
|
|
|
+ $where['yj_Yjno'] = $params['yj_no'];
|
|
|
+ $list = Db::name('工单_印件资料')->where($where)->field('yj_yjmc')->find();
|
|
|
+ $option['Gy0_gdbh'] = $params['order'];
|
|
|
+ $option['Gy0_yjno'] = $params['yj_no'];
|
|
|
+ $option['Gy0_site'] = '检验车间';
|
|
|
+ $option['Gy0_gxmc'] = array('not in',['包装','外发加工','废挑正','成品防护']);
|
|
|
+ $gxList = Db::name('工单_工艺资料')->where($option)->field('Gy0_gxh,rtrim(Gy0_gxmc) as Gy0_gxmc,rtrim(Add_gxmc) as Add_gxmc')->select();
|
|
|
+ $max = Db::name('设备_产量计酬')->where('sczl_gdbh',$params['order'])->where('sczl_yjno',$params['yj_no'])->field('MAX(sczl_num) as sczl_num')->value('sczl_num');
|
|
|
+ $list['gx_data'] = $gxList;
|
|
|
+ $list['max_num'] = $max;
|
|
|
+ $this->success('请求成功',$list);
|
|
|
+
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取废品分类
|
|
|
+ * @ApiMethod GET
|
|
|
+ * @params string search
|
|
|
+ */
|
|
|
+ public function getWastInfo(){
|
|
|
+ if (Request::instance()->isGet() == false){
|
|
|
+ $this->error('非法请求');
|
|
|
+ }
|
|
|
+ $params = Request::instance()->param();
|
|
|
+ if (!isset($params['search']) || empty($params['search'])){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $where['分类'] = '废品分类';
|
|
|
+ $where['名称'] = array('like','%'.$params['search'].'%');
|
|
|
+ $data = Db::name('erp_常用字典')->where($where)->column('名称');
|
|
|
+ // 分割字符串并合并相同项
|
|
|
+ $resultArray = [];
|
|
|
+ foreach ($data as $item) {
|
|
|
+ $parts = explode('_', $item);
|
|
|
+ // 使用第一个部分作为一级键,第二个部分作为二级键
|
|
|
+ $firstKey = $parts[0];
|
|
|
+ $secondKey = $parts[1];
|
|
|
+ $thirdValue = $parts[2];
|
|
|
+
|
|
|
+ $resultArray[$firstKey][$secondKey][] = $thirdValue;
|
|
|
+ }
|
|
|
+ // 对废品分类下的数组进行升序排序
|
|
|
+ if (isset($resultArray['data']['废品分类'])) {
|
|
|
+ foreach ($resultArray['data']['废品分类'] as &$category) {
|
|
|
+ // 判断是关联数组(单凹等)还是索引数组(分切等)
|
|
|
+ if (is_array($category) && !empty($category) && is_array(current($category))) {
|
|
|
+ foreach ($category as &$subCategory) {
|
|
|
+ ksort($subCategory);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ksort($category);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $this->success('请求成功',$resultArray);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ *获取工序及责任组长
|
|
|
+ * @ApiMethod GET
|
|
|
+ * @params string type
|
|
|
+ * @params string order
|
|
|
+ */
|
|
|
+ public function getGxAndLeader(){
|
|
|
+ if (Request::instance()->isGet() == false){
|
|
|
+ $this->error('非法请求');
|
|
|
+ }
|
|
|
+ $params = Request::instance()->param();
|
|
|
+ if (!isset($params['type']) || empty($params['type'])){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ if (!isset($params['order']) || empty($params['order'])){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $type = trim($params['type']);
|
|
|
+ $waste = Db::name('erp_常用字典')->where('名称','like','%'.$type.'%')->find();
|
|
|
+ if (empty($waste)){
|
|
|
+ $this->error('未查询到废品分类');
|
|
|
+ }
|
|
|
+ $wasteType = explode('_',substr($waste['名称'],0,-1));
|
|
|
+ $searchArr = explode('-',$wasteType[1]);
|
|
|
+ $search = substr($searchArr[1],0,6);
|
|
|
+ $where['a.sczl_gdbh'] = $params['order'];
|
|
|
+ $where['a.sczl_type'] = array('like','%'.$search.'%');
|
|
|
+ $list = Db::name('设备_产量计酬')->alias('a')
|
|
|
+ ->join('人事_基本资料 b','a.sczl_bh1 = b.员工编号','left')
|
|
|
+ ->where($where)->field('distinct(a.sczl_gxmc),a.sczl_bzdh,a.sczl_jtbh,a.sczl_bh1,b.员工姓名 as name')
|
|
|
+ ->select();
|
|
|
+ $count = count($list);
|
|
|
+ $list[$count]['sczl_gxmc'] = '99-外发加工';
|
|
|
+ $list[$count]['sczl_bzdh'] = 'A班';
|
|
|
+ $list[$count]['sczl_jtbh'] = '';
|
|
|
+ $list[$count]['sczl_bh1'] = '000000';
|
|
|
+ $list[$count]['name'] = '计时工';
|
|
|
+ $this->success('请求成功',$list);
|
|
|
+ }
|
|
|
+
|
|
|
}
|